-
Notifications
You must be signed in to change notification settings - Fork 0
150 lines (138 loc) · 4.17 KB
/
release.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
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
name: Release
on:
workflow_dispatch:
push:
branches:
- main
paths:
- app/**
- test/**
- compose.yml
- install.sh
- example.env
- .github/workflows/release.yml
# Comment literaly to make it run automatically and correctly I hope...
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
# pytest:
# name: Pytest
# runs-on: ubuntu-latest
# strategy:
# matrix:
# python-version: ["3.10.x", "3.11.x"]
# steps:
# - name: Checkout
# uses: actions/checkout@v3
# - name: Set up Python ${{ matrix.python-version }}
# uses: actions/setup-python@v4
# with:
# python-version: ${{ matrix.python-version }}
# - name: Install Python Dependencies
# run: |
# pip3 install -r app/requirements.txt
# - name: Install Testing Dependecies
# run: |
# pip3 install pytest httpx
# - name: Run PyTest
# run: |
# pytest
source:
name: Source
# needs: pytest
runs-on: ubuntu-latest
outputs:
v_tag: ${{steps.version.outputs.version_tag}}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get Version Tag
id: version
uses: paulhatch/[email protected]
with:
tag_prefix: ''
major_pattern: "Major"
minor_pattern: "Minor"
version_format: "${major}.${minor}.${patch}-prerelease${increment}"
change_path: "app"
# search_commit_body: true
# If this is set to true, *every* commit will be treated as a new version.
bump_each_commit: true
- name: Find and Replace
uses: jacobtomlinson/gha-find-replace@v3
with:
include: app/Dockerfile
find: ENV VERSION=\d{1,3}\.\d{1,3}\.\d{1,3}
replace: ENV VERSION=${{ steps.version.outputs.version_tag }}
regex: true
- name: Commit & Push Version Change
uses: actions-js/push@master
with:
message: Auto Version Bump
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.version.outputs.version_tag }}
name: Version ${{ steps.version.outputs.version_tag }}
generateReleaseNotes: true
# draft: true
# prerelease: true
makeLatest: true
updateOnlyUnreleased: false
allowUpdates: true
omitBodyDuringUpdate: true
omitNameDuringUpdate: true
omitPrereleaseDuringUpdate: true
container:
name: Container
needs: source
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
pull-requests: write
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Login to Registry
uses: docker/login-action@v2
if: github.event_name != 'pull_request'
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Setup Docker Buildx
uses: docker/[email protected]
-
name: Extract Metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
${{ needs.source.outputs.v_tag }}
latest
flavor: |
latest=auto
-
name: Build and Push Docker Image
id: build-and-push
uses: docker/build-push-action@v4
if: ${{ github.event_name != 'pull_request' }}
with:
platforms: linux/amd64,linux/arm64
context: ./app
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max