Skip to content

Commit

Permalink
ci: add release ci (#19)
Browse files Browse the repository at this point in the history
* ci: add release ci

---------

Co-authored-by: pengzhen <[email protected]>
  • Loading branch information
fearlessfe and pengzhen authored Jan 16, 2025
1 parent 127aaa1 commit 35d302d
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: shisui release image

on:
release:
types: [created]

defaults:
run:
shell: bash

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: write

env:
releaseBuild: ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags/') }}
REGISTRY: ghcr.io
TAG_NAME: ${{ github.ref | replace('refs/tags/', '') }}

jobs:
push_image_to_github:
name: Push Docker image to Github
runs-on: ubuntu-latest
permissions: write-all
if: ${{ env.releaseBuild == 'true' }} # Only run this job if releaseBuild is true
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ env.REGISTRY }}/${{ github.repository }}:${{ env.TAG_NAME }}

0 comments on commit 35d302d

Please sign in to comment.