|
1 | 1 | name: Build and Publish |
2 | 2 |
|
3 | | -env: |
4 | | - REGISTRY: ghcr.io |
5 | | - PACKAGE_NAME: patreon-db-sync |
6 | | - GITHUB_REPOSITORY_OWNER: ${{ github.repository_owner }} |
7 | | - GITHUB_SHA: ${{ github.sha }} |
8 | | - |
9 | 3 | on: |
10 | 4 | push: |
11 | 5 | branches: [ "main" ] |
12 | | - workflow_dispatch: {} |
| 6 | + tags: |
| 7 | + - '*' |
| 8 | + workflow_dispatch: |
13 | 9 |
|
14 | 10 | jobs: |
15 | | - publish-image: |
16 | | - runs-on: ubuntu-latest |
| 11 | + run: |
| 12 | + uses: ticketsbot-cloud/template/.github/workflows/template.yaml@main |
17 | 13 | permissions: |
18 | 14 | contents: read |
19 | 15 | packages: write |
20 | | - |
21 | | - steps: |
22 | | - - name: Checkout repository |
23 | | - uses: actions/checkout@v3 |
24 | | - with: |
25 | | - submodules: recursive |
26 | | - |
27 | | - - name: Print Go version |
28 | | - run: | |
29 | | - go version |
30 | | -
|
31 | | - - name: Log in to the Container registry |
32 | | - uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 |
33 | | - with: |
34 | | - registry: ${{ env.REGISTRY }} |
35 | | - username: ${{ github.actor }} |
36 | | - password: ${{ secrets.GITHUB_TOKEN }} |
37 | | - |
38 | | - - name: Determine image tag |
39 | | - id: determine-tag |
40 | | - run: | |
41 | | - if [[ "${{ github.event_name }}" == "push" && "${{ github.ref_type }}" == "tag" ]]; then |
42 | | - TAG="${{ github.ref_name }}" |
43 | | - else |
44 | | - TAG="latest" |
45 | | - fi |
46 | | - echo "IMAGE_TAG=${TAG}" >> $GITHUB_ENV |
47 | | -
|
48 | | - - name: Set image name |
49 | | - run: | |
50 | | - echo "IMAGE_NAME=${REGISTRY}/${GITHUB_REPOSITORY_OWNER,,}/${PACKAGE_NAME,,}" >> ${GITHUB_ENV} |
51 | | -
|
52 | | - - name: Extract metadata (tags, labels) for Docker |
53 | | - id: meta |
54 | | - uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 |
55 | | - with: |
56 | | - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} |
57 | | - |
58 | | - - name: Build and push Docker image |
59 | | - uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 |
60 | | - with: |
61 | | - context: . |
62 | | - push: true |
63 | | - tags: | |
64 | | - ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} |
65 | | - ${{ env.IMAGE_NAME }}:${{ github.sha }} |
66 | | - labels: ${{ steps.meta.outputs.labels }} |
67 | | - |
68 | | - - name: Log image name |
69 | | - run: | |
70 | | - echo "Image URI: ${IMAGE_NAME}" |
| 16 | + with: |
| 17 | + package_name: patreon-db-sync |
| 18 | + sha: ${{ github.sha }} |
| 19 | + secrets: inherit |
0 commit comments