2022-11-29 23:50:31 +00:00
|
|
|
# Runs on releases
|
|
|
|
|
2024-08-02 00:54:19 +00:00
|
|
|
name: Publish release
|
2022-11-29 23:50:31 +00:00
|
|
|
on:
|
|
|
|
release:
|
2024-04-21 12:20:13 +00:00
|
|
|
types: [published]
|
2024-08-02 00:54:19 +00:00
|
|
|
permissions:
|
|
|
|
contents: read
|
2024-04-21 12:20:13 +00:00
|
|
|
|
2022-11-29 23:50:31 +00:00
|
|
|
jobs:
|
|
|
|
stable:
|
|
|
|
runs-on: ubuntu-latest
|
2024-08-02 00:54:19 +00:00
|
|
|
name: Write release to stable branch
|
2024-05-14 12:04:03 +00:00
|
|
|
permissions:
|
|
|
|
contents: write
|
|
|
|
pull-requests: write
|
2022-12-21 12:00:23 +00:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2022-11-29 23:50:31 +00:00
|
|
|
steps:
|
|
|
|
- name: Checkout Code
|
2024-06-18 13:42:05 +00:00
|
|
|
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # pin@v4.1.7
|
2022-11-29 23:50:31 +00:00
|
|
|
- name: Version Check
|
|
|
|
run: |
|
2024-05-27 07:49:05 +00:00
|
|
|
pip install --require-hashes -r contrib/dev_reqs/requirements.txt
|
2022-11-29 23:50:31 +00:00
|
|
|
python3 .github/scripts/version_check.py
|
|
|
|
- name: Push to Stable Branch
|
2023-10-24 22:18:53 +00:00
|
|
|
uses: ad-m/github-push-action@d91a481090679876dfc4178fef17f286781251df # pin@v0.8.0
|
2022-11-29 23:50:31 +00:00
|
|
|
if: env.stable_release == 'true'
|
|
|
|
with:
|
|
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
branch: stable
|
|
|
|
force: true
|
2023-07-20 00:12:08 +00:00
|
|
|
|
2024-08-02 00:54:19 +00:00
|
|
|
build:
|
2023-07-20 00:12:08 +00:00
|
|
|
runs-on: ubuntu-latest
|
2024-08-02 00:54:19 +00:00
|
|
|
name: Build and attest frontend
|
2024-05-14 12:04:03 +00:00
|
|
|
permissions:
|
2024-08-02 00:54:19 +00:00
|
|
|
id-token: write
|
2024-05-14 12:04:03 +00:00
|
|
|
contents: write
|
2024-08-02 00:54:19 +00:00
|
|
|
attestations: write
|
2023-07-20 00:12:08 +00:00
|
|
|
steps:
|
2024-06-18 13:42:05 +00:00
|
|
|
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # pin@v4.1.7
|
2023-07-20 00:12:08 +00:00
|
|
|
- name: Environment Setup
|
|
|
|
uses: ./.github/actions/setup
|
|
|
|
with:
|
|
|
|
npm: true
|
|
|
|
- name: Install dependencies
|
|
|
|
run: cd src/frontend && yarn install
|
|
|
|
- name: Build frontend
|
2024-03-19 21:58:50 +00:00
|
|
|
run: cd src/frontend && npm run compile && npm run build
|
2024-08-02 00:54:19 +00:00
|
|
|
- name: Create SBOM for frontend
|
|
|
|
uses: anchore/sbom-action@v0
|
|
|
|
with:
|
|
|
|
artifact-name: frontend-build.spdx
|
|
|
|
path: src/frontend
|
2024-07-18 05:35:09 +00:00
|
|
|
- name: Write version file - SHA
|
|
|
|
run: cd src/backend/InvenTree/web/static/web/.vite && echo "$GITHUB_SHA" > sha.txt
|
|
|
|
- name: Write version file - TAG
|
|
|
|
run: cd src/backend/InvenTree/web/static/web/.vite && echo "${{ github.ref_name }}" > tag.txt
|
2023-07-20 00:12:08 +00:00
|
|
|
- name: Zip frontend
|
|
|
|
run: |
|
|
|
|
cd src/backend/InvenTree/web/static/web
|
2024-06-20 10:04:28 +00:00
|
|
|
zip -r ../frontend-build.zip * .vite
|
2024-08-02 00:54:19 +00:00
|
|
|
- name: Attest Build Provenance
|
|
|
|
id: attest
|
|
|
|
uses: actions/attest-build-provenance@v1
|
|
|
|
with:
|
|
|
|
subject-path: "${{ github.workspace }}/src/backend/InvenTree/web/static/frontend-build.zip"
|
|
|
|
|
|
|
|
- name: Upload frontend
|
|
|
|
uses: svenstaro/upload-release-action@04733e069f2d7f7f0b4aebc4fbdbce8613b03ccd # pin@2.9.0
|
2023-07-20 00:12:08 +00:00
|
|
|
with:
|
|
|
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
file: src/backend/InvenTree/web/static/frontend-build.zip
|
|
|
|
asset_name: frontend-build.zip
|
|
|
|
tag: ${{ github.ref }}
|
|
|
|
overwrite: true
|
2024-08-02 00:54:19 +00:00
|
|
|
- name: Upload Attestation
|
|
|
|
uses: svenstaro/upload-release-action@04733e069f2d7f7f0b4aebc4fbdbce8613b03ccd # pin@2.9.0
|
|
|
|
with:
|
|
|
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
asset_name: frontend-build.intoto.jsonl
|
|
|
|
file: ${{ steps.attest.outputs.bundle-path}}
|
|
|
|
tag: ${{ github.ref }}
|
|
|
|
overwrite: true
|