refactor: simplify release step with local env variables

Improves the readability and makes it easier to debug.

PR: #42
This commit is contained in:
innovaker 2021-05-14 19:12:34 +01:00
parent 70e225f229
commit 30b4589480

View File

@ -243,23 +243,30 @@ jobs:
with: with:
username: ${{ secrets.DOCKER_HUB_USERNAME }} username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }} password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Repository name
id: repository
run: echo ::set-output name=name::zmk-${{ matrix.target }}-${{ matrix.architecture }}
- name: Release (pull candidate, tag, push) - name: Release (pull candidate, tag, push)
env:
DHNS: ${{ env.docker-hub-namespace }}
GHCRNS: ${{ env.ghcr-namespace }}
TARGET: ${{ matrix.target }}
ARCHITECTURE: ${{ matrix.architecture }}
CANDIDATE: ${{ needs.tags.outputs.candidate }}
VERSIONS: ${{ needs.tags.outputs.versions }}
LATEST: ${{ needs.tags.outputs.latest }}
run: | run: |
docker pull docker.io/${{ env.docker-hub-namespace }}/${{ steps.repository.outputs.name }}:${{ needs.tags.outputs.candidate }} REPOSITORY=zmk-${TARGET}-${ARCHITECTURE}
docker tag docker.io/${{ env.docker-hub-namespace }}/${{ steps.repository.outputs.name }}:${{ needs.tags.outputs.candidate }} docker.io/${{ env.docker-hub-namespace }}/${{ steps.repository.outputs.name }}:${{ needs.tags.outputs.versions }}
docker tag docker.io/${{ env.docker-hub-namespace }}/${{ steps.repository.outputs.name }}:${{ needs.tags.outputs.candidate }} docker.io/${{ env.docker-hub-namespace }}/${{ steps.repository.outputs.name }}:${{ needs.tags.outputs.latest }} docker pull docker.io/${DHNS}/${REPOSITORY}:${CANDIDATE}
docker tag docker.io/${{ env.docker-hub-namespace }}/${{ steps.repository.outputs.name }}:${{ needs.tags.outputs.candidate }} ghcr.io/${{ env.ghcr-namespace }}/${{ steps.repository.outputs.name }}:${{ needs.tags.outputs.candidate }} docker tag docker.io/${DHNS}/${REPOSITORY}:${CANDIDATE} docker.io/${DHNS}/${REPOSITORY}:${VERSIONS}
docker tag docker.io/${{ env.docker-hub-namespace }}/${{ steps.repository.outputs.name }}:${{ needs.tags.outputs.candidate }} ghcr.io/${{ env.ghcr-namespace }}/${{ steps.repository.outputs.name }}:${{ needs.tags.outputs.versions }} docker tag docker.io/${DHNS}/${REPOSITORY}:${CANDIDATE} docker.io/${DHNS}/${REPOSITORY}:${LATEST}
docker tag docker.io/${{ env.docker-hub-namespace }}/${{ steps.repository.outputs.name }}:${{ needs.tags.outputs.candidate }} ghcr.io/${{ env.ghcr-namespace }}/${{ steps.repository.outputs.name }}:${{ needs.tags.outputs.latest }} docker tag docker.io/${DHNS}/${REPOSITORY}:${CANDIDATE} ghcr.io/${GHCRNS}/${REPOSITORY}:${CANDIDATE}
docker push docker.io/${{ env.docker-hub-namespace }}/${{ steps.repository.outputs.name }}:${{ needs.tags.outputs.candidate }} docker tag docker.io/${DHNS}/${REPOSITORY}:${CANDIDATE} ghcr.io/${GHCRNS}/${REPOSITORY}:${VERSIONS}
docker push docker.io/${{ env.docker-hub-namespace }}/${{ steps.repository.outputs.name }}:${{ needs.tags.outputs.versions }} docker tag docker.io/${DHNS}/${REPOSITORY}:${CANDIDATE} ghcr.io/${GHCRNS}/${REPOSITORY}:${LATEST}
docker push docker.io/${{ env.docker-hub-namespace }}/${{ steps.repository.outputs.name }}:${{ needs.tags.outputs.latest }} docker push docker.io/${DHNS}/${REPOSITORY}:${CANDIDATE}
docker push ghcr.io/${{ env.ghcr-namespace }}/${{ steps.repository.outputs.name }}:${{ needs.tags.outputs.candidate }} docker push docker.io/${DHNS}/${REPOSITORY}:${VERSIONS}
docker push ghcr.io/${{ env.ghcr-namespace }}/${{ steps.repository.outputs.name }}:${{ needs.tags.outputs.versions }} docker push docker.io/${DHNS}/${REPOSITORY}:${LATEST}
docker push ghcr.io/${{ env.ghcr-namespace }}/${{ steps.repository.outputs.name }}:${{ needs.tags.outputs.latest }} docker push ghcr.io/${GHCRNS}/${REPOSITORY}:${CANDIDATE}
docker push ghcr.io/${GHCRNS}/${REPOSITORY}:${VERSIONS}
docker push ghcr.io/${GHCRNS}/${REPOSITORY}:${LATEST}
git-tag: git-tag:
needs: needs:
- tags - tags