-
Notifications
You must be signed in to change notification settings - Fork 65
155 lines (141 loc) · 4.71 KB
/
release.yml
File metadata and controls
155 lines (141 loc) · 4.71 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
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
151
152
153
154
155
name: release
on:
push:
branches:
- main
tags-ignore:
- dev
pull_request:
defaults:
run:
shell: bash
permissions: {}
# Cancel any in-flight jobs for the same PR/branch so there's only one active
# at a time
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ${{ matrix.os }}
permissions:
contents: read
actions: write
strategy:
matrix:
include:
- build: x86_64-linux
os: ubuntu-latest
- build: x86_64-macos
os: macos-latest
target: x86_64-apple-darwin
- build: aarch64-macos
os: macos-latest
target: aarch64-apple-darwin
- build: x86_64-windows
os: windows-latest
- build: x86_64-mingw
os: windows-latest
target: x86_64-pc-windows-gnu
- build: aarch64-linux
os: ubuntu-latest
target: aarch64-unknown-linux-gnu
- build: s390x-linux
os: ubuntu-latest
target: s390x-unknown-linux-gnu
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: ./.github/actions/install-rust
- uses: ./.github/actions/binary-compatible-builds
with:
name: ${{ matrix.build }}
- run: |
echo CARGO_BUILD_TARGET=${{ matrix.target }} >> $GITHUB_ENV
rustup target add ${{ matrix.target }}
if: matrix.target != ''
# Build `wizer` and executables
- run: $CENTOS cargo build --release --locked --bin wizer --all-features
# Assemble release artifats appropriate for this platform, then upload them
# unconditionally to this workflow's files so we have a copy of them.
- run: ./ci/build-tarballs.sh "${{ matrix.build }}" "${{ matrix.target }}"
- uses: actions/upload-artifact@v4
with:
name: bins-${{ matrix.build }}
path: dist
publish:
needs:
- build
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
actions: read
steps:
- uses: actions/checkout@v2
# Download all the artifacts that we'll be publishing. Should keep an eye on
# the `download-artifact` repository to see if we can ever get something
# like "download all artifacts" or "download this list of artifacts"
- uses: actions/download-artifact@v4
with:
name: bins-x86_64-macos
path: dist
- uses: actions/download-artifact@v4
with:
name: bins-aarch64-macos
path: dist
- uses: actions/download-artifact@v4
with:
name: bins-x86_64-windows
path: dist
- uses: actions/download-artifact@v4
with:
name: bins-x86_64-mingw
path: dist
- uses: actions/download-artifact@v4
with:
name: bins-x86_64-linux
path: dist
- uses: actions/download-artifact@v4
with:
name: bins-aarch64-linux
path: dist
- uses: actions/download-artifact@v4
with:
name: bins-s390x-linux
path: dist
- name: Calculate tag name
run: |
name=dev
if [[ $GITHUB_REF == refs/tags/v* ]]; then
name=${GITHUB_REF:10}
fi
echo ::set-output name=val::$name
echo TAG=$name >> $GITHUB_ENV
id: tagname
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: '>=24'
registry-url: 'https://registry.npmjs.org'
# ... and if this was an actual push (tag or `main`) then we publish a
# new release. This'll automatically publish a tag release or update `dev`
# with this `sha`. Note that `continue-on-error` is set here so if this hits
# a bug we can go back and fetch and upload the release ourselves.
- run: cd .github/actions/github-release && npm install --production
- name: Publish Release
uses: ./.github/actions/github-release
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
continue-on-error: true
with:
files: "dist/*"
token: ${{ secrets.GITHUB_TOKEN }}
name: ${{ steps.tagname.outputs.val }}
- name: Update npm packages to latest version
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
working-directory: ./npm/wizer
run: npm install && node update.js "${{ steps.tagname.outputs.val }}"
- name: Publish npm packages
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
working-directory: ./npm
run: for dir in *; do (echo $dir && cd $dir && npm publish); done