diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 1da1b2d..4a91799 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,9 +1,8 @@ name: Docker on: - push: - branches: - - main + release: + types: [published, prereleased] jobs: docker: @@ -12,9 +11,19 @@ jobs: - uses: actions/checkout@v2 - name: Build - run: docker build -t ghcr.io/hyperledger/firefly-tokens-erc1155:latest . - - - name: Push + run: docker build -t ghcr.io/hyperledger/firefly-tokens-erc1155:${GITHUB_REF##*/} . + + - name: Tag release + if: github.event.action == 'published' + run: docker tag ghcr.io/hyperledger/firefly-tokens-erc1155:${GITHUB_REF##*/} ghcr.io/hyperledger/firefly-tokens-erc1155:latest + + - name: Push docker image + run: | + echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin + docker push ghcr.io/hyperledger/firefly-tokens-erc1155:${GITHUB_REF##*/} + + - name: Push latest tag + if: github.event.action == 'published' run: | echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin - docker push ghcr.io/hyperledger/firefly-tokens-erc1155:latest + docker push ghcr.io/hyperledger/firefly-tokens-erc1155:latest \ No newline at end of file