|
| 1 | +name: Publish by Manual |
| 2 | +on: |
| 3 | + workflow_dispatch: |
| 4 | + inputs: |
| 5 | + branch: |
| 6 | + description: 'Select the branch to deploy' |
| 7 | + required: true |
| 8 | + default: 'master' |
| 9 | + |
| 10 | +env: |
| 11 | + REGISTRY: ghcr.io |
| 12 | + NAME: koreanbots/core |
| 13 | + |
| 14 | +jobs: |
| 15 | + image-push: |
| 16 | + name: Push docker image |
| 17 | + runs-on: ubuntu-latest |
| 18 | + permissions: |
| 19 | + contents: read |
| 20 | + packages: write |
| 21 | + steps: |
| 22 | + - uses: actions/checkout@v2 |
| 23 | + with: |
| 24 | + ref: ${{ github.event.inputs.branch }} |
| 25 | + submodules: true |
| 26 | + - name: Parse image tag |
| 27 | + run: | |
| 28 | + parsed=${GITHUB_REF#refs/*/} |
| 29 | + echo "RELEASE_TAG=${parsed//\//-}" >> $GITHUB_ENV |
| 30 | + - name: Set up Docker Buildx |
| 31 | + uses: docker/setup-buildx-action@v2 |
| 32 | + - name: Log in to the Container registry |
| 33 | + uses: docker/login-action@v2 |
| 34 | + with: |
| 35 | + registry: ${{ env.REGISTRY }} |
| 36 | + username: ${{ github.repository_owner }} |
| 37 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 38 | + - name: Get metadata for Docker |
| 39 | + uses: docker/metadata-action@v4 |
| 40 | + id: meta |
| 41 | + with: |
| 42 | + images: ${{ env.REGISTRY }}/${{ env.NAME }} |
| 43 | + tags: | |
| 44 | + type=raw,value=latest,priority=100 |
| 45 | + type=sha,prefix=,suffix=,format=short,priority=300 |
| 46 | + type=schedule,pattern={{date 'YYYYMMDD-hhmmss' tz='Asia/Seoul'}} |
| 47 | + - name: Build and push |
| 48 | + uses: docker/build-push-action@v4 |
| 49 | + with: |
| 50 | + context: . |
| 51 | + push: true |
| 52 | + tags: ${{ steps.meta.outputs.tags }} |
| 53 | + labels: ${{ steps.meta.outputs.labels }} |
| 54 | + cache-from: type=gha |
| 55 | + cache-to: type=gha,mode=max |
| 56 | + build-args: | |
| 57 | + SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }} |
| 58 | + NEXT_PUBLIC_SENTRY_DSN=${{ secrets.SENTRY_DSN }} |
| 59 | + SENTRY_DSN=${{ secrets.SENTRY_DSN }} |
| 60 | + NEXT_PUBLIC_HCAPTCHA_SITEKEY=${{ secrets.NEXT_PUBLIC_HCAPTCHA_SITEKEY }} |
| 61 | + SOURCE_COMMIT=${{ github.sha }} |
| 62 | + TAG=${{ env.RELEASE_TAG }} |
0 commit comments