Skip to content
This repository has been archived by the owner on Feb 14, 2023. It is now read-only.

Commit

Permalink
handle release
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasMassart committed Oct 15, 2021
1 parent 1d7af81 commit 84004cd
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
push:
branches:
- main
release:
types: [published]
branches: [main]

env:
IMAGE_NAME: doctools-builder
Expand Down Expand Up @@ -38,24 +41,27 @@ jobs:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Push image
- name: Set image name
shell: sh
run: |
IMAGE_ID=$REGISTRY/${{ github.repository_owner }}/$IMAGE_NAME
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
echo IMAGE_ID=$IMAGE_ID
echo "IMAGE_ID=$IMAGE_ID" >> $GITHUB_ENV
# Publish latest always
- name: Push latest
shell: sh
run: |
docker tag $IMAGE_NAME $IMAGE_ID:$IMAGE_LATEST_TAG
docker push $IMAGE_ID:$IMAGE_LATEST_TAG
- name: Push tagged release
if: github.event_name == 'release' && github.event.action == 'published'
shell: sh
run: |
IMAGE_TAG=${GITHUB_REF#refs/*/}
# Publish release only if tag exists
if [ "$IMAGE_TAG" != "" ]; then
docker tag $IMAGE_NAME $IMAGE_ID:$IMAGE_TAG
docker push $IMAGE_ID:$IMAGE_TAG
fi
docker tag $IMAGE_NAME $IMAGE_ID:$IMAGE_TAG
docker push $IMAGE_ID:$IMAGE_TAG
- name: Test building doc using our action
uses: ConsenSys/doctools.action-builder/actions/build@main
Expand Down

0 comments on commit 84004cd

Please sign in to comment.