Skip to content

Commit

Permalink
chore: Dual push to GHCR
Browse files Browse the repository at this point in the history
  • Loading branch information
franky47 committed Apr 9, 2024
1 parent 568bdb3 commit 0010cc1
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,21 @@ jobs:
needs: ci
runs-on: ubuntu-latest
steps:
- id: docker-tag
run: |
tag=$( \
echo ${{ github.ref_name }} \
| sed 's#refs/heads/##g' \
| sed 's#refs/tags/##g' \
| sed 's#refs/pull/##g' \
| tr '/' '_' \
| tr -d '#' \
)
if [ "$tag" == "master" ]; then
echo "tag=latest" >> $GITHUB_OUTPUT
else
echo "tag=$tag" >> $GITHUB_OUTPUT
fi
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: manusa/actions-publish-docker@db938e45d2a3487e0eab9646e83550f554c17af3
name: Build & publish Docker image
Expand All @@ -39,11 +54,8 @@ jobs:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
include pull requests: true
tag script: |
const tag = context.ref
.replace('refs/heads/', '')
.replace('refs/tags/', '')
.replace('refs/pull/', '')
.replace(/\//g, '_')
.replace(/#/g, '');
return tag === 'master' ? 'latest' : tag;
tag: ${{ steps.docker-tag.outputs.tag }}
- run: docker push ghcr.io/47ng/actions-clever-cloud:${{ steps.docker-tag.outputs.tag }}
env:
DOCKER_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
DOCKER_USERNAME: ${{ github.actor }}

0 comments on commit 0010cc1

Please sign in to comment.