|
1 | 1 | name: main |
2 | 2 | on: |
3 | 3 | push: |
4 | | - branches: |
5 | | - - devel |
6 | | - pull_request: |
7 | 4 | concurrency: |
8 | 5 | group: ${{ github.ref }}-${{ github.workflow }} |
9 | 6 | cancel-in-progress: true |
@@ -100,23 +97,6 @@ jobs: |
100 | 97 | name: ubuntu-latest |
101 | 98 | path: WeiDU-Linux-*.zip |
102 | 99 | if-no-files-found: error |
103 | | - build-docker: |
104 | | - runs-on: ubuntu-latest |
105 | | - steps: |
106 | | - - name: Checkout |
107 | | - uses: actions/checkout@v4.2.2 |
108 | | - with: |
109 | | - fetch-depth: 0 |
110 | | - submodules: true |
111 | | - - name: Set up Docker Buildx |
112 | | - uses: docker/setup-buildx-action@v3 |
113 | | - - name: Build and push Docker image |
114 | | - uses: docker/build-push-action@v6 |
115 | | - with: |
116 | | - context: . |
117 | | - push: false |
118 | | - cache-from: type=gha |
119 | | - cache-to: type=gha |
120 | 100 | build-windows: |
121 | 101 | runs-on: windows-2022 |
122 | 102 | steps: |
@@ -145,56 +125,62 @@ jobs: |
145 | 125 | name: windows-latest |
146 | 126 | path: WeiDU-Windows-*.zip |
147 | 127 | if-no-files-found: error |
148 | | - build-docs: |
| 128 | + build-docker: |
| 129 | + runs-on: ubuntu-latest |
| 130 | + steps: |
| 131 | + - name: Checkout |
| 132 | + uses: actions/checkout@v4.2.2 |
| 133 | + with: |
| 134 | + fetch-depth: 0 |
| 135 | + submodules: true |
| 136 | + - name: Set up Docker Buildx |
| 137 | + uses: docker/setup-buildx-action@v3 |
| 138 | + - name: Build and push Docker image |
| 139 | + uses: docker/build-push-action@v6 |
| 140 | + with: |
| 141 | + context: . |
| 142 | + push: false |
| 143 | + cache-from: type=gha |
| 144 | + cache-to: type=gha |
| 145 | + trigger-nightly-release: |
| 146 | + needs: [build-nix, build-macos, build-linux, build-windows,build-docker] |
| 147 | + if: github.ref == 'refs/heads/devel' |
149 | 148 | runs-on: ubuntu-latest |
150 | 149 | steps: |
151 | 150 | - uses: actions/checkout@main |
152 | | - - uses: cachix/install-nix-action@master |
| 151 | + - name: generate_version |
| 152 | + id: generate_version |
| 153 | + run: | |
| 154 | + major_version=$(grep 'version =' src/version.ml | cut -d'"' -f2 | cut -c-3) |
| 155 | + minor_version=$(grep 'version =' src/version.ml | cut -d'"' -f2 | cut -c4-) |
| 156 | + echo "version=${major_version}.${minor_version}" >> "$GITHUB_OUTPUT" |
| 157 | + - name: create tag |
| 158 | + uses: actions/github-script@v8 |
153 | 159 | with: |
154 | | - nix_path: nixpkgs=channel:nixos-25.05 |
155 | | - - name: Build static files |
156 | | - shell: 'nix develop -c bash -e {0}' |
| 160 | + script: | |
| 161 | + const short_sha = context.sha.substring(0, 7); |
| 162 | + github.rest.git.createRef({ |
| 163 | + owner: context.repo.owner, |
| 164 | + repo: context.repo.repo, |
| 165 | + ref: `refs/tags/v${{ steps.generate_version.outputs.version }}-nightly-${short_sha}`, |
| 166 | + sha: context.sha, |
| 167 | + }); |
| 168 | + - name: trigger |
157 | 169 | run: | |
158 | | - make -C doc |
159 | | - release: |
160 | | - name: release |
161 | | - permissions: |
162 | | - contents: write |
163 | | - needs: [build-nix, build-macos, build-linux, build-windows] |
| 170 | + short_sha=$(git rev-parse --short ${{ github.sha }}) |
| 171 | + ref=$(echo "v${{ steps.generate_version.outputs.version }}-nightly-${short_sha}") |
| 172 | + echo "${ref}" |
| 173 | + gh workflow run release.yaml --ref "${ref}" -f run_id=${{ github.run_id }} |
| 174 | + env: |
| 175 | + GH_TOKEN: ${{ github.token }} |
| 176 | + trigger-release: |
| 177 | + needs: [build-nix, build-macos, build-linux, build-windows,build-docker] |
| 178 | + if: startsWith(github.ref, 'refs/tags/') |
164 | 179 | runs-on: ubuntu-latest |
165 | | - if: github.event_name == 'push' && github.ref_name == 'devel' |
166 | 180 | steps: |
167 | 181 | - uses: actions/checkout@main |
168 | | - - name: download linux artifact |
169 | | - uses: actions/download-artifact@main |
170 | | - with: |
171 | | - name: ubuntu-latest |
172 | | - path: linux |
173 | | - - name: download mac artifact |
174 | | - uses: actions/download-artifact@main |
175 | | - with: |
176 | | - name: macos-15-intel |
177 | | - path: macos |
178 | | - - name: download mac artifact |
179 | | - uses: actions/download-artifact@main |
180 | | - with: |
181 | | - name: macos-latest |
182 | | - path: macos-arm |
183 | | - - name: download windows artifact |
184 | | - uses: actions/download-artifact@main |
185 | | - with: |
186 | | - name: windows-latest |
187 | | - path: windows |
188 | | - - run: | |
189 | | - mv linux/*.zip . |
190 | | - mv macos/*.zip . |
191 | | - mv macos-arm/WeiDU-Mac-250.zip WeiDU-Mac-ARM-250.zip |
192 | | - mv windows/*.zip . |
193 | | - - name: Create Release |
194 | | - id: create_release |
195 | | - uses: ncipollo/release-action@v1.20.0 |
196 | | - with: |
197 | | - generateReleaseNotes: true |
198 | | - artifacts: "*zip" |
199 | | - prerelease: true |
200 | | - name: nightly-${{ github.sha }} |
| 182 | + - name: trigger |
| 183 | + run: | |
| 184 | + gh workflow run release.yaml --ref ${{ github.ref_name }} -f run_id=${{ github.run_id }} |
| 185 | + env: |
| 186 | + GH_TOKEN: ${{ github.token }} |
0 commit comments