Skip to content

Commit d51f80f

Browse files
authored
Refactor build and publish workflow to use template [skip-ci]
1 parent afb54c4 commit d51f80f

1 file changed

Lines changed: 9 additions & 60 deletions

File tree

Lines changed: 9 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,19 @@
11
name: Build and Publish
22

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-
93
on:
104
push:
115
branches: [ "main" ]
12-
workflow_dispatch: {}
6+
tags:
7+
- '*'
8+
workflow_dispatch:
139

1410
jobs:
15-
publish-image:
16-
runs-on: ubuntu-latest
11+
run:
12+
uses: ticketsbot-cloud/template/.github/workflows/template.yaml@main
1713
permissions:
1814
contents: read
1915
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

Comments
 (0)