Partially revert "Remove short commit hash to prevent version collisi… #1228
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
push: | |
branches: | |
- master | |
- beta | |
- develop | |
tags: | |
- '[0-9]+.[0-9]+.[0-9]+' | |
- '[0-9]+.[0-9]+.[0-9]+-*' | |
pull_request: | |
branches: | |
- master | |
- beta | |
- develop | |
types: [opened, reopened, synchronize] | |
workflow_dispatch: # Manually invoked by user. | |
name: ci-build | |
env: | |
NODE_VERSION: 20 | |
PYTHON_VERSION: 3.12 | |
jobs: | |
getvars: | |
uses: ./.github/workflows/get-vars.yml | |
build-frontend: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
sparse-checkout: | | |
.github | |
frontend | |
- uses: ./.github/actions/build-frontend | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
build-staticfs: | |
runs-on: ubuntu-latest | |
needs: build-frontend | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/build-staticfs | |
with: | |
skip-checkout: true | |
build-firmware: | |
needs: [getvars] | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJSON(needs.getvars.outputs.board-matrix) }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/build-firmware | |
with: | |
board: ${{ matrix.board }} | |
version: ${{ needs.getvars.outputs.version }} | |
skip-checkout: true | |
merge-partitions: | |
needs: [getvars, build-staticfs, build-firmware] | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJSON(needs.getvars.outputs.board-matrix) }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
sparse-checkout: | | |
.github | |
scripts | |
boards | |
chips | |
- uses: ./.github/actions/merge-partitions | |
with: | |
version: ${{ needs.getvars.outputs.version }} | |
board: ${{ matrix.board }} | |
skip-checkout: true | |
checkpoint-build: | |
runs-on: ubuntu-latest | |
needs: [merge-partitions] | |
steps: | |
- run: echo "Builds checkpoint reached" | |
cdn-upload-firmware: | |
needs: [getvars, checkpoint-build] | |
if: ${{ needs.getvars.outputs.should-deploy == 'true' }} | |
runs-on: ubuntu-latest | |
environment: cdn-firmware-r2 | |
strategy: | |
fail-fast: true | |
matrix: ${{ fromJson(needs.getvars.outputs.board-matrix) }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
sparse-checkout: | | |
.github | |
# Set up rclone for CDN uploads. | |
- uses: ./.github/actions/cdn-prepare | |
with: | |
cf-account-id: ${{ vars.S3_ACCOUNT_ID }} | |
cf-access-key-id: ${{ vars.S3_ACCESS_KEY_ID }} | |
cf-secret-access-key: ${{ secrets.S3_SECRET_ACCESS_KEY }} | |
# Upload firmware to CDN. | |
- uses: ./.github/actions/cdn-upload-firmware | |
with: | |
cf-bucket: ${{ vars.S3_BUCKET }} | |
fw-version: ${{ needs.getvars.outputs.version }} | |
board: ${{ matrix.board }} | |
cdn-upload-version-info: | |
needs: [getvars, checkpoint-build] | |
if: ${{ needs.getvars.outputs.should-deploy == 'true' }} | |
runs-on: ubuntu-latest | |
environment: cdn-firmware-r2 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
sparse-checkout: | | |
.github | |
# Set up rclone for CDN uploads. | |
- uses: ./.github/actions/cdn-prepare | |
with: | |
cf-account-id: ${{ vars.S3_ACCOUNT_ID }} | |
cf-access-key-id: ${{ vars.S3_ACCESS_KEY_ID }} | |
cf-secret-access-key: ${{ secrets.S3_SECRET_ACCESS_KEY }} | |
# Upload firmware to CDN. | |
- uses: ./.github/actions/cdn-upload-version-info | |
with: | |
cf-bucket: ${{ vars.S3_BUCKET }} | |
fw-version: ${{ needs.getvars.outputs.version }} | |
release-channel: ${{ needs.getvars.outputs.release-channel }} | |
boards: ${{ needs.getvars.outputs.board-list }} | |
cdn-bump-version: | |
runs-on: ubuntu-latest | |
needs: [getvars, cdn-upload-firmware] # only after version is complete | |
environment: cdn-firmware-r2 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
sparse-checkout: | | |
.github | |
# Set up rclone for CDN uploads. | |
- uses: ./.github/actions/cdn-prepare | |
with: | |
cf-account-id: ${{ vars.S3_ACCOUNT_ID }} | |
cf-access-key-id: ${{ vars.S3_ACCESS_KEY_ID }} | |
cf-secret-access-key: ${{ secrets.S3_SECRET_ACCESS_KEY }} | |
# Upload firmware to CDN. | |
- uses: ./.github/actions/cdn-bump-version | |
with: | |
cf-bucket: ${{ vars.S3_BUCKET }} | |
version: ${{ needs.getvars.outputs.version }} | |
release-channel: ${{ needs.getvars.outputs.release-channel }} | |
checkpoint-cdn: | |
runs-on: ubuntu-latest | |
needs: [cdn-upload-firmware, cdn-upload-version-info, cdn-bump-version] | |
steps: | |
- run: echo "CDN checkpoint reached" | |
release: | |
needs: [getvars, checkpoint-cdn] | |
if: (needs.getvars.outputs.release-channel == 'stable' || needs.getvars.outputs.release-channel == 'beta') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download release artifacts | |
uses: actions/download-artifact@v4 | |
- name: Display artifacts | |
run: ls -R | |
- name: Release | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: '**/OpenShock_*.bin' | |
tag: ${{ needs.getvars.outputs.version }} | |
prerelease: ${{ needs.getvars.outputs.release-channel != 'stable' }} | |
artifactErrorsFailBuild: true | |
body: ${{ needs.getvars.outputs.release-notes }} |