forked from pyx-industries/pyx-identity-resolver
-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (59 loc) · 1.98 KB
/
package.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: Package
on:
push:
tags:
- "v*.*.*" # vMAJOR.MINOR.PATCH | v0.0.1
workflow_dispatch: # Manually run the workflow
# Run the workflow when the Release Tagging workflow completes
workflow_run:
workflows: ['Release Tagging']
types:
- completed
env:
CI: true
jobs:
build:
runs-on: ubuntu-latest
# Trigger the job only if the Release Tagging job was successful or manually triggered
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event.ref == 'refs/heads/master' }}
env:
# Only push the image if the new tag is pushed or manually triggered
PUSH_CONDITION: ${{ startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master' }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: docker meta details
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{github.repository}}
flavor: |
latest=auto
tags: |
type=edge,branch=master
type=semver,pattern={{version}}
type=sha
- name: Set up Docker
uses: docker/setup-buildx-action@v3
- name: Login to Github Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push Local Image
uses: docker/build-push-action@v5
with:
push: ${{ env.PUSH_CONDITION }}
tags: ${{ steps.meta.outputs.tags }}-local
labels: ${{ steps.meta.outputs.labels }}
context: app
file: app/Dockerfile
- name: Build and Push Serverless Image
uses: docker/build-push-action@v5
with:
push: ${{ env.PUSH_CONDITION }}
tags: ${{ steps.meta.outputs.tags }}-serverless
labels: ${{ steps.meta.outputs.labels }}
context: app
file: app/Dockerfile.serverless