diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..7081ecf --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,47 @@ +name: Build + +on: + release: + types: + - created + pull_request: + branches: + - master + - develop + +jobs: + docker: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: login to GHCR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ github.token }} + + - name: determine docker tag + id: docker_tag + uses: actions/github-script@v7 + with: + result-encoding: string + script: | + const tagExec = await exec.getExecOutput('git', ['describe', '--tags', '--abbrev=0']); + return tagExec.stdout || tagExec.stderr; + + - name: build docker image + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: | + ghcr.io/${{ github.repository }}:latest + ghcr.io/${{ github.repository }}:${{ steps.docker_tag.outputs.result }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bf4516e..ffaa672 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,10 +15,10 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: actions/setup-java@v3 + - uses: actions/setup-java@v4 with: distribution: corretto java-version: 17 @@ -50,8 +50,8 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-java@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 with: distribution: corretto java-version: 17 @@ -65,10 +65,10 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: build docker image - uses: docker/build-push-action@v3 + uses: docker/build-push-action@v5 with: context: . push: false