fork/glide

git clone https://git.julia.blue/fork/glide

Tyler Mandryfix(ci): Actually codesign release again91014dd

main
3.7 KiB118 linesraw
1name: Package
2
3on:
4  push:
5    tags:
6      - "v*.*.*"
7    branches:
8      - main
9
10env:
11  CARGO_INCREMENTAL: 0
12  CARGO_NET_RETRY: 10
13  CARGO_TERM_COLOR: always
14  RUST_BACKTRACE: 1
15  RUSTUP_MAX_RETRIES: 10
16
17jobs:
18  package:
19    environment: packaging
20    runs-on: macos-15
21    permissions:
22      contents: write
23
24    steps:
25      - name: Install cargo-packager
26        uses: taiki-e/cache-cargo-install-action@v2
27        with:
28          tool: cargo-packager@0.11.8
29
30      - name: Install parse-changelog
31        uses: taiki-e/cache-cargo-install-action@v2
32        with:
33          tool: parse-changelog@0.6.14
34
35      - uses: actions/checkout@v4
36        with:
37          persist-credentials: false
38
39      # release-please normally parses the pull request description for release notes.
40      # Instead of having two sources of truth, get them from the changelog.
41      #
42      # The workflow still isn't perfect because release-please can overwrite
43      # the PR if new changes land, but it's good enough for now.
44      - name: Parse changelog
45        if: github.ref_type == 'tag'
46        run: |
47          GLIDE_VERSION=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name == "glide-wm") | .version')
48          parse-changelog CHANGELOG.md $GLIDE_VERSION > CHANGELOG_version.md
49
50      - name: Install latest stable
51        run: |
52          rustup update stable
53          rustup target add aarch64-apple-darwin
54          rustup target add x86_64-apple-darwin
55
56      - name: Build
57        run: |
58          cargo build --release --verbose --locked --target aarch64-apple-darwin
59          cargo build --release --verbose --locked --target x86_64-apple-darwin
60
61      - name: Import code-signing certificates
62        uses: apple-actions/import-codesign-certs@v3
63        with:
64          p12-file-base64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
65          p12-password: ${{ secrets.P12_PASSWORD }}
66
67      - name: Import notarization API key
68        if: github.ref_type == 'tag'
69        env:
70          APPLE_API_KEY_BASE64: ${{ secrets.APPLE_API_KEY_BASE64 }}
71        run: |
72          echo "$APPLE_API_KEY_BASE64" | base64 --decode > AuthKey.p8
73
74      - name: Package, sign, and notarize
75        env:
76          APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }}
77          APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
78          APPLE_API_KEY_PATH: AuthKey.p8
79        run: |
80          if [[ "${{ github.ref_type }}" != "tag" ]]; then
81            # Disable notarization.
82            unset APPLE_API_KEY
83            unset APPLE_API_ISSUER
84          fi
85          # For debugging; should show the signing identity
86          security find-identity -v -p codesigning
87
88          # HACK: Add --deep flag so codesign doesn't complain about signing
89          # binaries in the wrong order (only on x86_64, wtf)
90          mkdir -p ~/.bin
91          cat <<'END' >~/.bin/codesign
92          #!/bin/bash
93          exec /usr/bin/codesign "$@" --deep
94          END
95          chmod +x ~/.bin/codesign
96          export PATH=~/.bin:"$PATH"
97
98          # Package, sign, and notarize
99          cargo packager --release --target aarch64-apple-darwin
100          cargo packager --release --target x86_64-apple-darwin
101
102      - uses: actions/upload-artifact@v4
103        with:
104          path: target/*-apple-darwin/release/Glide_*.dmg
105
106      - name: Release
107        uses: softprops/action-gh-release@v2
108        if: github.ref_type == 'tag'
109        with:
110          files: |
111            target/aarch64-apple-darwin/release/Glide_*.dmg
112            target/x86_64-apple-darwin/release/Glide_*.dmg
113          fail_on_unmatched_files: true
114          body_path: CHANGELOG_version.md
115          # To keep release-please's notes, comment the line above and uncomment
116          # these lines:
117          # body: ""
118          # append_body: true