-
Notifications
You must be signed in to change notification settings - Fork 0
113 lines (101 loc) · 3.31 KB
/
Copy pathcode_deployment.yml
File metadata and controls
113 lines (101 loc) · 3.31 KB
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
name: Build and publish Docker image
on:
push:
branches: [main, cicd/*]
workflow_dispatch:
# pull_request:
# types: [closed]
# branches: [main]
concurrency: production
jobs:
release:
name: Tag and create GitHub release
runs-on: ubuntu-24.04-arm
permissions:
contents: write
outputs:
new_tag: ${{ steps.version.outputs.new_tag }}
part: ${{ steps.version.outputs.part }}
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Bump release version and push tag
id: version
uses: anothrNick/github-tag-action@1.75.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIT_API_TAGGING: true
WITH_V: false
INITIAL_VERSION: 0.1.0
DEFAULT_BUMP: patch
DEFAULT_BRANCH: main
RELEASE_BRANCHES: main
- name: Create a GitHub release
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.version.outputs.new_tag }}
name: Release ${{ steps.version.outputs.new_tag }}
body: ${{ steps.version.outputs.changelog }}
publish:
name: Build and publish Docker image to GitHub Packages
needs: release
if: needs.release.outputs.part != 'patch'
runs-on: ubuntu-24.04-arm
permissions:
contents: read
packages: write
actions: write
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Authenticate with GitHub Container Registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Add tags and labels
id: meta
uses: docker/metadata-action@v6
with:
images: ghcr.io/${{ github.repository }}
tags: type=semver,pattern={{version}},value=${{ needs.release.outputs.new_tag }}
flavor: latest=auto
- name: Set up QEMU
uses: docker/setup-qemu-action@v4
with:
platforms: arm64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
with:
platforms: linux/arm64
- name: Build and push API Docker image
uses: docker/build-push-action@v7
with:
context: ./api
file: ./api/Dockerfile
platforms: linux/arm64
push: true
tags: |
ghcr.io/${{ github.repository }}/api:${{ needs.release.outputs.new_tag }}
ghcr.io/${{ github.repository }}/api:latest
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max,ignore-error=true
build-args: |
VERSION=${{ needs.release.outputs.new_tag }}
- name: Build and push App Docker image
uses: docker/build-push-action@v7
with:
context: ./app
file: ./app/Dockerfile
platforms: linux/arm64
push: true
tags: |
ghcr.io/${{ github.repository }}/app:${{ needs.release.outputs.new_tag }}
ghcr.io/${{ github.repository }}/app:latest
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max,ignore-error=true
build-args: |
VERSION=${{ needs.release.outputs.new_tag }}