|
6 | 6 | - "v*" |
7 | 7 |
|
8 | 8 | permissions: |
9 | | - contents: read |
| 9 | + contents: write |
| 10 | + id-token: write |
| 11 | + |
| 12 | +concurrency: |
| 13 | + group: release-${{ github.ref }} |
| 14 | + cancel-in-progress: true |
10 | 15 |
|
11 | 16 | env: |
12 | 17 | CARGO_TERM_COLOR: always |
|
15 | 20 | crates-io: |
16 | 21 | name: Publish to crates.io |
17 | 22 | runs-on: ubuntu-latest |
| 23 | + timeout-minutes: 30 |
18 | 24 | steps: |
19 | 25 | - uses: actions/checkout@v4 |
20 | 26 | - uses: dtolnay/rust-toolchain@stable |
|
71 | 77 | pypi-publish: |
72 | 78 | name: Publish to PyPI |
73 | 79 | runs-on: ubuntu-latest |
| 80 | + timeout-minutes: 30 |
74 | 81 | environment: |
75 | 82 | name: release |
76 | 83 | url: https://pypi.org/project/harmont/ |
@@ -108,3 +115,82 @@ jobs: |
108 | 115 | uses: pypa/gh-action-pypi-publish@release/v1 |
109 | 116 | with: |
110 | 117 | packages-dir: dsls/harmont-py/dist/ |
| 118 | + |
| 119 | + build-binary: |
| 120 | + name: Build ${{ matrix.target }} |
| 121 | + timeout-minutes: 30 |
| 122 | + strategy: |
| 123 | + fail-fast: false |
| 124 | + matrix: |
| 125 | + include: |
| 126 | + - target: x86_64-unknown-linux-gnu |
| 127 | + runner: ubuntu-latest |
| 128 | + - target: aarch64-unknown-linux-gnu |
| 129 | + runner: ubuntu-24.04-arm |
| 130 | + - target: aarch64-apple-darwin |
| 131 | + runner: macos-latest |
| 132 | + - target: x86_64-apple-darwin |
| 133 | + runner: macos-latest |
| 134 | + runs-on: ${{ matrix.runner }} |
| 135 | + steps: |
| 136 | + - uses: actions/checkout@v4 |
| 137 | + |
| 138 | + - uses: dtolnay/rust-toolchain@stable |
| 139 | + with: |
| 140 | + targets: ${{ matrix.target }} |
| 141 | + |
| 142 | + - uses: Swatinem/rust-cache@v2 |
| 143 | + with: |
| 144 | + key: ${{ matrix.target }} |
| 145 | + |
| 146 | + - uses: actions/setup-node@v4 |
| 147 | + with: |
| 148 | + node-version: "20" |
| 149 | + cache: npm |
| 150 | + cache-dependency-path: dsls/harmont-ts/package-lock.json |
| 151 | + |
| 152 | + - name: Install esbuild |
| 153 | + working-directory: dsls/harmont-ts |
| 154 | + run: npm ci |
| 155 | + |
| 156 | + - name: Set version from tag |
| 157 | + run: | |
| 158 | + VERSION="${GITHUB_REF_NAME#v}" |
| 159 | + echo "VERSION=$VERSION" >> "$GITHUB_ENV" |
| 160 | + sed -i'' -e 's/version = "0.0.0-dev"/version = "'"$VERSION"'"/' crates/hm/Cargo.toml |
| 161 | +
|
| 162 | + - name: Build |
| 163 | + run: cargo build --release --target ${{ matrix.target }} -p harmont-cli |
| 164 | + |
| 165 | + - name: Package |
| 166 | + run: | |
| 167 | + ARCHIVE="hm-${VERSION}-${{ matrix.target }}.tar.gz" |
| 168 | + tar czf "$ARCHIVE" -C "target/${{ matrix.target }}/release" hm |
| 169 | + echo "ARCHIVE=$ARCHIVE" >> "$GITHUB_ENV" |
| 170 | +
|
| 171 | + - uses: actions/upload-artifact@v4 |
| 172 | + with: |
| 173 | + name: hm-${{ matrix.target }} |
| 174 | + path: ${{ env.ARCHIVE }} |
| 175 | + retention-days: 1 |
| 176 | + |
| 177 | + github-release: |
| 178 | + name: Create GitHub Release |
| 179 | + timeout-minutes: 10 |
| 180 | + needs: build-binary |
| 181 | + runs-on: ubuntu-latest |
| 182 | + steps: |
| 183 | + - uses: actions/download-artifact@v4 |
| 184 | + with: |
| 185 | + path: artifacts |
| 186 | + merge-multiple: true |
| 187 | + |
| 188 | + - name: Create release |
| 189 | + env: |
| 190 | + GH_TOKEN: ${{ github.token }} |
| 191 | + run: | |
| 192 | + gh release create "$GITHUB_REF_NAME" \ |
| 193 | + --repo "$GITHUB_REPOSITORY" \ |
| 194 | + --title "$GITHUB_REF_NAME" \ |
| 195 | + --generate-notes \ |
| 196 | + artifacts/* |
0 commit comments