-
Notifications
You must be signed in to change notification settings - Fork 5
79 lines (79 loc) · 2.24 KB
/
ci.yaml
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
name: CI
on: push
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
goos: [windows, linux, darwin]
goarch: [amd64, arm64]
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: 0 # static binary
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 1.22.3
- run: make dist
- id: vars
run: echo "distpath=$(make distpath)" >> $GITHUB_OUTPUT
- uses: actions/upload-artifact@v4
with:
name: ${{ steps.vars.outputs.distpath }}
path: ${{ steps.vars.outputs.distpath }}
- run: sha256sum ${{ steps.vars.outputs.distpath }} > ${{ steps.vars.outputs.distpath }}.sha256
- uses: actions/upload-artifact@v4
with:
name: ${{ steps.vars.outputs.distpath }}.sha256
path: ${{ steps.vars.outputs.distpath }}.sha256
containerise:
runs-on: ubuntu-latest
needs: [build]
if: ${{ github.actor != 'dependabot[bot]' }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- uses: actions/download-artifact@v4
with:
path: artifacts
- run: |
mkdir dist
ls -lhR artifacts/
mv artifacts/*.tar.gz/* dist/ # ignore Windows and checksums
- run: python3 bin/artifact_docker_reorg.py dist/ docker/
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
username: gebn
password: ${{ secrets.DOCKERHUB_TOKEN }}
- id: vars
run: echo "tag=$(make tag)" >> $GITHUB_OUTPUT
- uses: docker/build-push-action@v6
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: gebn/unifibackup:${{ steps.vars.outputs.tag }}
release:
runs-on: ubuntu-latest
needs: [build]
if: startsWith(github.ref, 'refs/tags/v')
permissions:
# Required to create a release.
contents: write
steps:
- uses: actions/download-artifact@v4
with:
path: artifacts
- uses: softprops/action-gh-release@v2
with:
draft: true
prerelease: ${{ contains(github.ref, '-') }}
files: |
artifacts/*/*