-
-
Notifications
You must be signed in to change notification settings - Fork 37
91 lines (75 loc) · 2.73 KB
/
main.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
name: CI
on:
push:
tags:
- '*'
workflow_call:
inputs:
platforms:
required: false
type: string
secrets:
DOCKERHUB_TOKEN:
required: true
GOSS_CMD:
required: false
env:
DOCKERHUB_USERNAME: ${{ vars.DOCKERHUB_USERNAME }}
DOCKERHUB_REPOSITORY: ${{ vars.DOCKERHUB_REPOSITORY }}
DOCKERHUB_PLATFORMS: ${{ inputs.platforms || 'linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64' }}
jobs:
test:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Build ${{ env.DOCKERHUB_REPOSITORY }}:dev image
run: docker build -t ${{ env.DOCKERHUB_USERNAME }}/${{ env.DOCKERHUB_REPOSITORY }}:dev .
- uses: e1himself/[email protected]
with:
version: 'v0.4.9'
- name: Execute dgoss run on ${{ env.DOCKERHUB_REPOSITORY }}:dev image
env:
GOSS_FILES_STRATEGY: cp
run: dgoss run ${{ env.DOCKERHUB_USERNAME }}/${{ env.DOCKERHUB_REPOSITORY }}:dev ${{ secrets.GOSS_CMD }}
deploy:
needs: test
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: docker/[email protected]
with:
username: ${{ env.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- name: Build and push ${{ env.DOCKERHUB_REPOSITORY }} image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
platforms: ${{ env.DOCKERHUB_PLATFORMS }}
push: true
tags: |
${{ env.DOCKERHUB_USERNAME }}/${{ env.DOCKERHUB_REPOSITORY }}:latest
${{ env.DOCKERHUB_USERNAME }}/${{ env.DOCKERHUB_REPOSITORY }}:${{ github.ref_name }}
cache-from: type=registry,ref=${{ env.DOCKERHUB_USERNAME }}/${{ env.DOCKERHUB_REPOSITORY }}:buildcache
cache-to: type=registry,ref=${{ env.DOCKERHUB_USERNAME }}/${{ env.DOCKERHUB_REPOSITORY }}:buildcache,mode=max
- name: Generate CHANGELOG
id: changelog
uses: requarks/changelog-action@v1
with:
token: ${{ github.token }}
tag: ${{ github.ref_name }}
- name: Create github ${{ github.ref_name }} release
uses: ncipollo/release-action@v1
with:
makeLatest: true
allowUpdates: true
body: ${{ steps.changelog.output.changes }}
token: ${{ github.token }}
- name: Commit updated CHANGELOG.md for ${{ github.ref_name }}
uses: stefanzweifel/git-auto-commit-action@v5
with:
branch: main
commit_message: 'docs: update CHANGELOG.md for ${{ github.ref_name }} [skip ci]'
file_pattern: CHANGELOG.md