Skip to content

Commit

Permalink
Docker 镜像上传 GitHub Packages
Browse files Browse the repository at this point in the history
  • Loading branch information
lanthora committed Jul 16, 2023
1 parent acd8dee commit e03f009
Showing 1 changed file with 16 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,41 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Login to DockerHub
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push master branch
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and Push latest
if: github.ref == 'refs/heads/master'
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: lanthora/candy:latest
tags: |
lanthora/candy:latest
ghcr.io/lanthora/candy:latest
- name: Set VERSION variable from tag without v prefix
if: github.event_name == 'release'
run: |
TAG=${{ github.event.release.tag_name }}
echo "VERSION=${TAG#v}" >> $GITHUB_ENV
- name: Build and push release version
- name: Build and Push release
if: github.event_name == 'release'
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: lanthora/candy:${{ env.VERSION }}
tags: |
lanthora/candy:${{ env.VERSION }}
ghcr.io/lanthora/candy:${{ env.VERSION }}

0 comments on commit e03f009

Please sign in to comment.