@@ -83,88 +83,31 @@ jobs:
8383 npm install
8484 npm run build
8585
86- deploy-binaries :
87- name : Build and upload binaries
88- permissions :
89- contents : write
90- id-token : write
91- runs-on : ${{ matrix.os.os }}
92- # Only build on main or tag
86+ compute-version :
87+ runs-on : ubuntu-latest
9388 if : github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')
94- strategy :
95- fail-fast : false
96- matrix :
97- os :
98- - build : linux
99- os : ubuntu-22.04
100- target : x86_64-unknown-linux-gnu
101-
102- - build : macos
103- os : macos-latest
104- target : x86_64-apple-darwin
105-
106- - build : macos-m1
107- os : macos-latest
108- target : aarch64-apple-darwin
109-
110- - build : windows-gnu
111- os : windows-latest
112- target : x86_64-pc-windows-gnu
113- # python: ["3.9", "3.10", "3.11", "3.12", "3.13"]
114-
89+ outputs :
90+ version : ${{ steps.version.outputs.VERSION }}
11591 steps :
116- - name : Checkout
117- uses : actions/checkout@v7
118- with :
119- submodules : recursive
120- - run : rustup toolchain install stable --profile minimal
121- - if : matrix.os.target == 'x86_64-apple-darwin'
122- run : rustup target add x86_64-apple-darwin
123- - uses : Swatinem/rust-cache@v2
124- with :
125- cache-workspace-crates : true
126- add-job-id-key : false
127-
128- # - name: Set up python
129- # uses: actions/setup-python@v5
130- # with:
131- # python-version: ${{ matrix.python }}
132- - name : Build
133- run : cargo build --verbose --release --target ${{ matrix.os.target }}
92+ - uses : actions/checkout@v7
13493 - name : Decide on our version name (tag or "dev")
13594 id : version
13695 shell : bash
13796 run : |
138- if [ -n "$GITHUB_REF" ]; then
139- if [[ "$GITHUB_REF" == refs/tags/fontspector-v* ]]; then
140- echo "VERSION=${GITHUB_REF/refs\/tags\/fontspector-/}" >> $GITHUB_ENV
141- else
142- echo "VERSION=dev" >> $GITHUB_ENV
143- fi
144- else
145- echo "VERSION=dev" >> $GITHUB_ENV
146- fi
147- - name : Build archive
148- shell : bash
149- run : |
150- # dirname="fontspector-${{ env.VERSION }}-${{ matrix.os.target }}-py${{ matrix.python }}"
151- dirname="fontspector-${{ env.VERSION }}-${{ matrix.os.target }}"
152- mkdir "$dirname"
153- if [ "${{ matrix.os.os }}" = "windows-latest" ]; then
154- mv "target/${{ matrix.os.target }}/release/"*.exe "$dirname"
155- 7z a "$dirname.zip" "$dirname"
156- echo "ASSET=$dirname.zip" >> $GITHUB_ENV
97+ if [[ "$GITHUB_REF" == refs/tags/fontspector-v* ]]; then
98+ VERSION="${GITHUB_REF#refs/tags/fontspector-v}"
15799 else
158- mv "target/${{ matrix.os.target }}/release/fontspector" "$dirname"
159- tar -czf "$dirname.tar.gz" "$dirname"
160- echo "ASSET=$dirname.tar.gz" >> $GITHUB_ENV
100+ VERSION="dev"
161101 fi
162- - uses : actions/upload-artifact@v7
163- with :
164- name : ${{ env.ASSET }}
165- path : ${{ env.ASSET }}
166- - if : contains(github.ref, 'refs/tags/fontspector-v')
167- name : Add artefact to release
168- env :
169- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
170- run : gh release upload fontspector-${{ env.VERSION }} ${{ env.ASSET }}
102+ echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT"
103+
104+ deploy-binaries :
105+ name : Build and upload binaries
106+ if : github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')
107+ needs : compute-version
108+ permissions :
109+ contents : write
110+ id-token : write
111+ uses : ./.github/workflows/build-binary.yml
112+ with :
113+ version : ${{ needs.compute-version.outputs.version }}
0 commit comments