-
Notifications
You must be signed in to change notification settings - Fork 38
112 lines (106 loc) · 3.9 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
name: Release Builds
on:
push:
tags:
- 'v*' # on every version tag
jobs:
# first just a small job to draft the release so all others can use the upload_url
create_release:
runs-on: ubuntu-latest
steps:
- name: create release
id: create_release
uses: ncipollo/release-action@v1
build_ubuntu:
runs-on: ubuntu-20.04
needs: create_release
steps:
- uses: actions/checkout@v4
- name: build
run: bash .github/workflows/release.sh
- name: upload release assets linux
uses: AButler/upload-release-assets@v3.0
with:
files: 'agate.*.gz'
repo-token: ${{ secrets.GITHUB_TOKEN }}
release-tag: ${{ github.ref_name }}
build_windows:
runs-on: windows-latest
needs: create_release
steps:
- uses: actions/checkout@v4
- name: Build
run: cargo build --verbose --release
- name: strip names
run: strip target/release/agate.exe
- name: compress
run: Compress-Archive -LiteralPath target/release/agate.exe -DestinationPath agate.x86_64-pc-windows-msvc.zip
- name: upload release asset win
uses: AButler/upload-release-assets@v3.0
with:
files: agate.x86_64-pc-windows-msvc.zip
repo-token: ${{ secrets.GITHUB_TOKEN }}
release-tag: ${{ github.ref_name }}
build_macos_x86_64:
runs-on: macos-latest
needs: create_release
steps:
- uses: actions/checkout@v4
- name: install toolchain
run: rustup target add aarch64-apple-darwin
- name: Build x86_64
run: cargo build --verbose --release
- name: strip names x86
run: strip target/release/agate
- name: compress x86
run: gzip -c target/release/agate > ./agate.x86_64-apple-darwin.gz
- name: Build ARM
run: SDKROOT=$(xcrun -sdk macosx --show-sdk-path) MACOSX_DEPLOYMENT_TARGET=$(xcrun -sdk macosx --show-sdk-platform-version) cargo build --verbose --release --target=aarch64-apple-darwin
- name: strip names ARM
run: strip target/aarch64-apple-darwin/release/agate
- name: compress ARM
run: gzip -c target/aarch64-apple-darwin/release/agate > ./agate.aarch64-apple-darwin.gz
- name: upload release assets darwin
uses: AButler/upload-release-assets@v3.0
with:
files: 'agate.*.gz'
repo-token: ${{ secrets.GITHUB_TOKEN }}
release-tag: ${{ github.ref_name }}
build_docker:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Log into GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
# Because this workflow only runs on commits tagged `v*` (i n semver format) this section ensures that
# a docker build tagged `v1.2.3+podman.build` is tagged with `1`, `1.2`, `1.2.3` and `1.2.3+podman.build`
# as well as being tagged with `latest`. For each of these, a subsequent build that has the same tag will
# replace it. This means that pulling `ghcr.io/mbrubeck/agate:1` will always get the most recent image
# released with a v1 tag, container, `ghcr.io/mbrubeck/agate:1.2` will get the latest v1.2 tag, and so on.
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}.{{patch}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Build and push Docker image
id: push
uses: docker/build-push-action@v6
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}