Bump docker/login-action from 65b78e6e13532edd9afa3aa52ac7964289d1a9c1 to 3d58c274f17dffee475a5520cbe67f0a882c4dbb #15
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
branches: | |
- "main" | |
paths-ignore: | |
- '.gitignore' | |
- 'CODEOWNERS' | |
- 'LICENSE' | |
- '*.md' | |
pull_request: | |
paths-ignore: | |
- '.gitignore' | |
- 'CODEOWNERS' | |
- 'LICENSE' | |
- '*.md' | |
env: | |
JAVA_VERSION: 21 | |
JAVA_DISTRO: temurin | |
GH_BOT_EMAIL: "41898282+github-actions[bot]@users.noreply.github.com" | |
GH_BOT_NAME: "GitHub Action" | |
GRAALVM_DIST: graalvm-community | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: graalvm/setup-graalvm@v1 | |
with: | |
distribution: ${{ env.GRAALVM_DIST }} | |
java-version: ${{ env.JAVA_VERSION }} | |
cache: 'maven' | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Project metadata | |
id: metadata | |
run: | | |
SNAPSHOT=$(yq '.release.snapshot-version' .github/project.yml) | |
ARTIFACT=$(yq '.build.artifact' .github/project.yml) | |
echo "snapshot=${SNAPSHOT}" >> $GITHUB_OUTPUT | |
echo "artifact=${ARTIFACT}" >> $GITHUB_OUTPUT | |
- name: Build with Maven | |
run: | | |
./mvnw -B -ntp formatter:validate verify | |
- name: Build and run in native mode | |
id: mvn-native-build | |
env: | |
MAVEN_OPTS: "-Xmx1g" | |
run: | | |
./mvnw -B -ntp verify -Dnative -DskipTests -DskipFormat | |
- name: Update release with snapshot artifact | |
id: mvn-release-snapshot | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SNAPSHOT: ${{ steps.metadata.outputs.snapshot }} | |
run: | | |
git config user.name ${{ env.GH_BOT_NAME }} | |
git config user.email ${{ env.GH_BOT_EMAIL }} | |
ls -al target | |
AV=${{ steps.metadata.outputs.artifact }}-${{ steps.metadata.outputs.snapshot }} | |
gh release upload "${SNAPSHOT}" --clobber ./target/${AV}.jar#${AV}.jar | |
gh release upload "${SNAPSHOT}" --clobber ./target/${AV}-runner#${AV}-runner | |
echo "Update tag for $SNAPSHOT" | |
git push origin :refs/tags/$SNAPSHOT | |
git tag -f $SNAPSHOT | |
git push --tags | |
echo "Update $SNAPSHOT release" | |
gh release edit "${SNAPSHOT}" -t "${SNAPSHOT}" --prerelease | |
- name: Log in to the Container registry | |
uses: docker/login-action@3d58c274f17dffee475a5520cbe67f0a882c4dbb | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish OCI (native) | |
id: publish-oci | |
run: | | |
docker build -f src/main/docker/Dockerfile.native-micro -t ghcr.io/commonhaus/commonhaus-bot:latest . | |
docker push ghcr.io/commonhaus/commonhaus-bot:latest | |
- name: Mark snapshot release as non-draft | |
id: update-snapshot-release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SNAPSHOT: ${{ steps.metadata.outputs.snapshot }} | |
run: | | |
gh release edit "${SNAPSHOT}" --draft=false | |
gh release view "${SNAPSHOT}" |