-
Notifications
You must be signed in to change notification settings - Fork 0
101 lines (90 loc) · 2.89 KB
/
release.yml
File metadata and controls
101 lines (90 loc) · 2.89 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
name: Release
on:
push:
tags: ["v*"]
workflow_dispatch:
permissions:
contents: write
packages: write
jobs:
docker:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- image: ynab-tools
dockerfile: Dockerfile.amazon
- image: ynab-tools-monitor
dockerfile: Dockerfile.monitor
steps:
- uses: actions/checkout@v4
- name: Extract version from tag
id: version
run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
file: ${{ matrix.dockerfile }}
push: true
platforms: linux/amd64,linux/arm64
tags: |
ghcr.io/baker-scripts/${{ matrix.image }}:latest
ghcr.io/baker-scripts/${{ matrix.image }}:${{ steps.version.outputs.version }}
cache-from: type=gha
cache-to: type=gha,mode=max
github-release:
runs-on: ubuntu-latest
needs: docker
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build release notes
id: notes
run: |
TAG="${GITHUB_REF_NAME}"
PREV_TAG=$(git tag --sort=-v:refname | grep -A1 "^${TAG}$" | tail -1)
{
echo 'body<<EOF'
echo "## Docker Images"
echo ""
echo '```bash'
echo "docker pull ghcr.io/baker-scripts/ynab-tools:${TAG#v}"
echo "docker pull ghcr.io/baker-scripts/ynab-tools-monitor:${TAG#v}"
echo '```'
echo ""
echo "## Changes"
echo ""
if [ -n "$PREV_TAG" ] && [ "$PREV_TAG" != "$TAG" ]; then
git log --format="- %s (%h)" "${PREV_TAG}..${TAG}"
else
git log --format="- %s (%h)" -10 "${TAG}"
fi
echo ""
echo "**Full Changelog**: https://github.com/${{ github.repository }}/compare/${PREV_TAG}...${TAG}"
echo 'EOF'
} >> "$GITHUB_OUTPUT"
- name: Create or update GitHub Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if gh release view "$GITHUB_REF_NAME" >/dev/null 2>&1; then
gh release edit "$GITHUB_REF_NAME" \
--title "$GITHUB_REF_NAME" \
--notes "${{ steps.notes.outputs.body }}"
else
gh release create "$GITHUB_REF_NAME" \
--title "$GITHUB_REF_NAME" \
--notes "${{ steps.notes.outputs.body }}"
fi