|
1 | 1 | name: release |
2 | 2 | on: |
3 | | - workflow_dispatch: {} |
4 | 3 | push: |
5 | 4 | tags: |
6 | 5 | - v* |
| 6 | + workflow_dispatch: {} |
7 | 7 | permissions: |
8 | 8 | contents: write |
9 | 9 | jobs: |
| 10 | + release_create: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + needs: |
| 13 | + - release_build |
| 14 | + steps: |
| 15 | + - name: Checkout code |
| 16 | + uses: actions/checkout@v4 |
| 17 | + - name: Checkout repository |
| 18 | + uses: actions/checkout@v4 |
| 19 | + with: |
| 20 | + fetch-tags: true |
| 21 | + fetch-depth: 0 |
| 22 | + - name: Download artifacts |
| 23 | + uses: actions/download-artifact@v4 |
| 24 | + with: |
| 25 | + path: artifacts |
| 26 | + - id: version |
| 27 | + name: Get version from Cargo.toml |
| 28 | + run: | |
| 29 | + VERSION=$(grep -E '^version = ' Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/') |
| 30 | + { |
| 31 | + echo "version=$VERSION" |
| 32 | + } >> "$GITHUB_OUTPUT" |
| 33 | +
|
| 34 | + if [ "${{ github.event_name }}" = "push" ]; then |
| 35 | + TAG="${GITHUB_REF#refs/tags/}" |
| 36 | + EXPECTED_TAG="v$VERSION" |
| 37 | + if [ "$TAG" != "$EXPECTED_TAG" ]; then |
| 38 | + echo "Error: Tag $TAG doesn't match expected $EXPECTED_TAG from Cargo.toml" >&2 |
| 39 | + exit 1 |
| 40 | + fi |
| 41 | + { |
| 42 | + echo "tag=$TAG" |
| 43 | + } >> "$GITHUB_OUTPUT" |
| 44 | + else |
| 45 | + { |
| 46 | + echo "tag=v$VERSION" |
| 47 | + } >> "$GITHUB_OUTPUT" |
| 48 | + fi |
| 49 | + - name: Generate checksums |
| 50 | + run: | |
| 51 | + set -e |
| 52 | + cd artifacts |
| 53 | + for dir in */; do |
| 54 | + cd "$dir" |
| 55 | + for file in *; do |
| 56 | + case "$file" in |
| 57 | + *.tar.gz|*.zip) |
| 58 | + if [ -f "$file" ]; then |
| 59 | + sha256sum "$file" > "${file}.sha256" || shasum -a 256 "$file" | awk '{print $1}' > "${file}.sha256" |
| 60 | + fi |
| 61 | + ;; |
| 62 | + esac |
| 63 | + done |
| 64 | + cd .. |
| 65 | + done |
| 66 | + cd .. |
| 67 | + - name: Generate changelog |
| 68 | + run: | |
| 69 | + cat > changelog.md <<EOF |
| 70 | + ## Installation |
| 71 | +
|
| 72 | + ### One-liner (Linux/macOS) |
| 73 | + curl -fsSL https://docspring.github.io/cigen/install.sh | sh |
| 74 | +
|
| 75 | + ### Direct downloads |
| 76 | + - macOS (Intel): https://github.com/${{ github.repository }}/releases/download/${{ steps.version.outputs.tag }}/cigen-macos-amd64.tar.gz |
| 77 | + - macOS (Apple Silicon): https://github.com/${{ github.repository }}/releases/download/${{ steps.version.outputs.tag }}/cigen-macos-arm64.tar.gz |
| 78 | + - Linux (x86_64): https://github.com/${{ github.repository }}/releases/download/${{ steps.version.outputs.tag }}/cigen-linux-amd64.tar.gz |
| 79 | + - Linux (ARM64): https://github.com/${{ github.repository }}/releases/download/${{ steps.version.outputs.tag }}/cigen-linux-arm64.tar.gz |
| 80 | + EOF |
| 81 | + - name: Create GitHub Release |
| 82 | + uses: softprops/action-gh-release@v2 |
| 83 | + with: |
| 84 | + tag_name: ${{ steps.version.outputs.tag }} |
| 85 | + prerelease: ${{ contains(steps.version.outputs.tag, '-') }} |
| 86 | + body_path: changelog.md |
| 87 | + name: CIGen v${{ steps.version.outputs.version }} |
| 88 | + draft: false |
| 89 | + files: | |
| 90 | + artifacts/**/*.tar.gz |
| 91 | + artifacts/**/*.sha256 |
10 | 92 | docker_image: |
11 | 93 | runs-on: ubuntu-latest |
12 | 94 | needs: |
|
74 | 156 | - name: Checkout repository |
75 | 157 | uses: actions/checkout@v4 |
76 | 158 | with: |
77 | | - fetch-tags: true |
78 | 159 | fetch-depth: 0 |
| 160 | + fetch-tags: true |
79 | 161 | - name: Wait for required checks |
80 | 162 | uses: actions/github-script@v7 |
81 | 163 | with: |
@@ -106,87 +188,5 @@ jobs: |
106 | 188 | - name: Upload artifact |
107 | 189 | uses: actions/upload-artifact@v4 |
108 | 190 | with: |
109 | | - name: ${{ matrix.name }} |
110 | 191 | path: ${{ env.ASSET_PATH }} |
111 | | - release_create: |
112 | | - runs-on: ubuntu-latest |
113 | | - needs: |
114 | | - - release_build |
115 | | - steps: |
116 | | - - name: Checkout code |
117 | | - uses: actions/checkout@v4 |
118 | | - - name: Checkout repository |
119 | | - uses: actions/checkout@v4 |
120 | | - with: |
121 | | - fetch-tags: true |
122 | | - fetch-depth: 0 |
123 | | - - name: Download artifacts |
124 | | - uses: actions/download-artifact@v4 |
125 | | - with: |
126 | | - path: artifacts |
127 | | - - id: version |
128 | | - name: Get version from Cargo.toml |
129 | | - run: | |
130 | | - VERSION=$(grep -E '^version = ' Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/') |
131 | | - { |
132 | | - echo "version=$VERSION" |
133 | | - } >> "$GITHUB_OUTPUT" |
134 | | -
|
135 | | - if [ "${{ github.event_name }}" = "push" ]; then |
136 | | - TAG="${GITHUB_REF#refs/tags/}" |
137 | | - EXPECTED_TAG="v$VERSION" |
138 | | - if [ "$TAG" != "$EXPECTED_TAG" ]; then |
139 | | - echo "Error: Tag $TAG doesn't match expected $EXPECTED_TAG from Cargo.toml" >&2 |
140 | | - exit 1 |
141 | | - fi |
142 | | - { |
143 | | - echo "tag=$TAG" |
144 | | - } >> "$GITHUB_OUTPUT" |
145 | | - else |
146 | | - { |
147 | | - echo "tag=v$VERSION" |
148 | | - } >> "$GITHUB_OUTPUT" |
149 | | - fi |
150 | | - - name: Generate checksums |
151 | | - run: | |
152 | | - set -e |
153 | | - cd artifacts |
154 | | - for dir in */; do |
155 | | - cd "$dir" |
156 | | - for file in *; do |
157 | | - case "$file" in |
158 | | - *.tar.gz|*.zip) |
159 | | - if [ -f "$file" ]; then |
160 | | - sha256sum "$file" > "${file}.sha256" || shasum -a 256 "$file" | awk '{print $1}' > "${file}.sha256" |
161 | | - fi |
162 | | - ;; |
163 | | - esac |
164 | | - done |
165 | | - cd .. |
166 | | - done |
167 | | - cd .. |
168 | | - - name: Generate changelog |
169 | | - run: | |
170 | | - cat > changelog.md <<EOF |
171 | | - ## Installation |
172 | | -
|
173 | | - ### One-liner (Linux/macOS) |
174 | | - curl -fsSL https://docspring.github.io/cigen/install.sh | sh |
175 | | -
|
176 | | - ### Direct downloads |
177 | | - - macOS (Intel): https://github.com/${{ github.repository }}/releases/download/${{ steps.version.outputs.tag }}/cigen-macos-amd64.tar.gz |
178 | | - - macOS (Apple Silicon): https://github.com/${{ github.repository }}/releases/download/${{ steps.version.outputs.tag }}/cigen-macos-arm64.tar.gz |
179 | | - - Linux (x86_64): https://github.com/${{ github.repository }}/releases/download/${{ steps.version.outputs.tag }}/cigen-linux-amd64.tar.gz |
180 | | - - Linux (ARM64): https://github.com/${{ github.repository }}/releases/download/${{ steps.version.outputs.tag }}/cigen-linux-arm64.tar.gz |
181 | | - EOF |
182 | | - - name: Create GitHub Release |
183 | | - uses: softprops/action-gh-release@v2 |
184 | | - with: |
185 | | - tag_name: ${{ steps.version.outputs.tag }} |
186 | | - name: CIGen v${{ steps.version.outputs.version }} |
187 | | - prerelease: ${{ contains(steps.version.outputs.tag, '-') }} |
188 | | - draft: false |
189 | | - body_path: changelog.md |
190 | | - files: | |
191 | | - artifacts/**/*.tar.gz |
192 | | - artifacts/**/*.sha256 |
| 192 | + name: ${{ matrix.name }} |
0 commit comments