1- name : release
1+ # DO NOT EDIT - This file is generated by cigen
2+ # Source: .cigen/workflows/
3+ # Regenerate with: cargo run -- --config .cigen generate
4+ #
5+ name : RELEASE
26on :
37 push :
4- tags :
5- - v*
6- workflow_dispatch : {}
7- permissions :
8- contents : write
8+ branches :
9+ - main
10+ pull_request : {}
911jobs :
10- release_create :
12+ docker_image :
1113 runs-on : ubuntu-latest
12- needs :
13- - release_build
1414 steps :
1515 - name : Checkout code
1616 uses : actions/checkout@v4
17- - name : Checkout repository
18- uses : actions/checkout@v4
17+ - uses : actions/checkout@v4
1918 with :
20- fetch-tags : true
21- fetch-depth : 0
22- - name : Download artifacts
23- uses : actions/download-artifact@v4
19+ fetch-depth : |
20+ 0
21+ - run : |
22+ VERSION=$(grep -E '^version = ' Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/')
23+ echo "version=$VERSION" >> "$GITHUB_OUTPUT"
24+ - uses : docker/setup-qemu-action@v3
25+ - uses : docker/setup-buildx-action@v3
26+ - uses : docker/login-action@v3
2427 with :
25- path : artifacts
26- - id : version
27- name : Get version from Cargo.toml
28+ password : |
29+ ${{ env.DOCKERHUB_TOKEN }}
30+ username : |
31+ ${{ env.DOCKERHUB_USERNAME }}
32+ - name : Build and push multi-arch image
2833 run : |
34+ set -euo pipefail
35+ VERSION="${{ steps.v.outputs.version }}"
36+ echo "Building docspringcom/cigen:${VERSION} and :latest"
37+ docker buildx build \
38+ --platform linux/amd64,linux/arm64 \
39+ -f Dockerfile \
40+ --build-arg CIGEN_VERSION="${VERSION}" \
41+ -t docspringcom/cigen:"${VERSION}" \
42+ -t docspringcom/cigen:latest \
43+ --push .
44+ env :
45+ DOCKERHUB_TOKEN : ${{ secrets.DOCKERHUB_TOKEN }}
46+ DOCKERHUB_USERNAME : ${{ secrets.DOCKERHUB_USERNAME }}
47+ release_create :
48+ runs-on : ubuntu-latest
49+ steps :
50+ - name : Checkout code
51+ uses : actions/checkout@v4
52+ - uses : actions/checkout@v4
53+ with :
54+ fetch-tags : |
55+ true
56+ fetch-depth : |
57+ 0
58+ - uses : actions/download-artifact@v4
59+ with :
60+ path : |
61+ artifacts
62+ - run : |
2963 VERSION=$(grep -E '^version = ' Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/')
3064 {
3165 echo "version=$VERSION"
@@ -78,98 +112,46 @@ jobs:
78112 - Linux (x86_64): https://github.com/${{ github.repository }}/releases/download/${{ steps.version.outputs.tag }}/cigen-linux-amd64.tar.gz
79113 - Linux (ARM64): https://github.com/${{ github.repository }}/releases/download/${{ steps.version.outputs.tag }}/cigen-linux-arm64.tar.gz
80114 EOF
81- - name : Create GitHub Release
82- uses : softprops/action-gh-release@v2
115+ - uses : softprops/action-gh-release@v2
83116 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
117+ prerelease : |
118+ ${{ contains(steps.version.outputs.tag, '-') }}
89119 files : |
90- artifacts/**/*.tar.gz
91- artifacts/**/*.sha256
92- docker_image :
93- runs-on : ubuntu-latest
94- needs :
95- - release_create
96- steps :
97- - name : Checkout code
98- uses : actions/checkout@v4
99- - name : Checkout repository
100- uses : actions/checkout@v4
101- with :
102- fetch-depth : 0
103- - id : v
104- name : Extract version
105- run : |
106- VERSION=$(grep -E '^version = ' Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/')
107- echo "version=$VERSION" >> "$GITHUB_OUTPUT"
108- - name : Set up QEMU
109- uses : docker/setup-qemu-action@v3
110- - name : Set up Docker Buildx
111- uses : docker/setup-buildx-action@v3
112- - name : Log in to Docker Hub
113- uses : docker/login-action@v3
114- with :
115- username : ${{ env.DOCKERHUB_USERNAME }}
116- password : ${{ env.DOCKERHUB_TOKEN }}
117- - name : Build and push multi-arch image
118- run : |
119- set -euo pipefail
120- VERSION="${{ steps.v.outputs.version }}"
121- echo "Building docspringcom/cigen:${VERSION} and :latest"
122- docker buildx build \
123- --platform linux/amd64,linux/arm64 \
124- -f Dockerfile \
125- --build-arg CIGEN_VERSION="${VERSION}" \
126- -t docspringcom/cigen:"${VERSION}" \
127- -t docspringcom/cigen:latest \
128- --push .
129- env :
130- DOCKERHUB_USERNAME : ${{ secrets.DOCKERHUB_USERNAME }}
131- DOCKERHUB_TOKEN : ${{ secrets.DOCKERHUB_TOKEN }}
132- permissions :
133- contents : read
120+ |
121+ artifacts/**/*.tar.gz
122+ artifacts/**/*.sha256
123+ tag_name : |
124+ ${{ steps.version.outputs.tag }}
125+ draft : |
126+ false
127+ name : |
128+ CIGen v${{ steps.version.outputs.version }}
129+ body_path : |
130+ changelog.md
134131 release_build :
135- runs-on : ${{ matrix.os }}
136- strategy :
137- matrix :
138- include :
139- - name : cigen-macos-amd64
140- os : macos-latest
141- target : x86_64-apple-darwin
142- - name : cigen-macos-arm64
143- os : macos-latest
144- target : aarch64-apple-darwin
145- - name : cigen-linux-amd64
146- os : ubuntu-latest
147- target : x86_64-unknown-linux-gnu
148- - name : cigen-linux-arm64
149- os : ubuntu-latest
150- target : aarch64-unknown-linux-gnu
151- use-cross : true
152- fail-fast : false
132+ runs-on : ubuntu-latest
133+ container :
134+ image : ${{ matrix.os }}
153135 steps :
154136 - name : Checkout code
155137 uses : actions/checkout@v4
156- - name : Checkout repository
157- uses : actions/checkout@v4
138+ - uses : actions/checkout@v4
158139 with :
159- fetch-depth : 0
160- fetch-tags : true
161- - name : Wait for required checks
162- uses : actions/github-script@v7
140+ fetch-tags : |
141+ true
142+ fetch-depth : |
143+ 0
144+ - uses : actions/github-script@v7
163145 with :
164146 script : |
165- const script = require('./.github/wait-for-checks.js');
166- await script({ github, context, core } );
167- - name : Install Rust
168- uses : dtolnay/rust-toolchain@stable
147+ |
148+ const script = require('./.github/wait-for-checks.js' );
149+ await script({ github, context, core });
150+ - uses : dtolnay/rust-toolchain@stable
169151 with :
170- targets : ${{ matrix.target }}
171- - name : Install cross (for cross-compilation)
172- run : cargo install cross --git https://github.com/cross-rs/cross
152+ targets : |
153+ ${{ matrix.target }}
154+ - run : cargo install cross --git https://github.com/cross-rs/cross
173155 - name : Build binary
174156 run : |
175157 set -e
@@ -185,8 +167,9 @@ jobs:
185167 tar czf "../../../${{ matrix.name }}.tar.gz" cigen
186168 cd ../../../
187169 echo "ASSET_PATH=${{ matrix.name }}.tar.gz" >> "$GITHUB_ENV"
188- - name : Upload artifact
189- uses : actions/upload-artifact@v4
170+ - uses : actions/upload-artifact@v4
190171 with :
191- path : ${{ env.ASSET_PATH }}
192- name : ${{ matrix.name }}
172+ name : |
173+ ${{ matrix.name }}
174+ path : |
175+ ${{ env.ASSET_PATH }}
0 commit comments