Merge pull request #218 from hyperledger-firefly/dependabot/github_ac… #149
This file contains hidden or 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: Docker Main Build | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| docker: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@96fe6ef7f33517b61c61be40b68a1882f3264fb8 # v4.2.0 | |
| - name: Set up Docker Buildx | |
| id: buildx | |
| uses: docker/setup-buildx-action@37fe631027851001ddb9b187196cc803df7f5f0e # v4.3.0 | |
| - name: Docker login | |
| uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set build tag | |
| id: build_tag_generator | |
| run: | | |
| RELEASE_TAG=$(curl https://api.github.com/repos/${{ github.repository }}/releases/latest -s | jq .tag_name -r) | |
| BUILD_TAG=$RELEASE_TAG-$(date +"%Y%m%d")-$GITHUB_RUN_NUMBER | |
| BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") | |
| echo "BUILD_TAG=$BUILD_TAG" >> $GITHUB_OUTPUT | |
| echo "name=BUILD_DATE=$BUILD_DATE" >> $GITHUB_OUTPUT | |
| - name: Build and push | |
| uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0 | |
| with: | |
| context: ./ | |
| file: ./Dockerfile | |
| builder: ${{ steps.buildx.outputs.name }} | |
| push: true | |
| platforms: linux/amd64 | |
| provenance: false | |
| tags: ghcr.io/${{ github.repository }}:${{ steps.build_tag_generator.outputs.BUILD_TAG }},ghcr.io/${{ github.repository }}:head | |
| labels: | | |
| commit=${{ github.sha }} | |
| build_date=${{ steps.build_tag_generator.outputs.BUILD_DATE }} | |
| tag=${{ steps.build_tag_generator.outputs.BUILD_TAG }} | |
| cache-from: type=registry,ref=ghcr.io/${{ github.repository }}:buildcache | |
| cache-to: type=registry,ref=ghcr.io/${{ github.repository }}:buildcache,mode=max | |
| build-args: | | |
| BUILD_VERSION=${{ steps.build_tag_generator.outputs.BUILD_TAG }} | |
| GIT_REF=${{ github.ref }} |