From 3ee7d355b6515056dce8450f1f668409603d780a Mon Sep 17 00:00:00 2001 From: Donkie Date: Fri, 29 Dec 2023 00:35:51 +0100 Subject: [PATCH] Added new CI jobs for release automation --- .github/workflows/release.yml | 59 +++++++++++++++++++++++++++ .github/workflows/trigger-release.yml | 43 +++++++++++++++++++ 2 files changed, 102 insertions(+) create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/trigger-release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..d18a397 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,59 @@ +name: Release + +on: + push: + tags: + - "v*.*.*" + +jobs: + package: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Install node + uses: actions/setup-node@v3 + with: + node-version: '20' + + - name: Install dependencies + run: | + cd client + npm ci + + - name: Build + run: | + cd client + rm -f .env && echo "VITE_APIURL=/api/v1" > .env.production + npm run build + + - name: Generate release info + run: | + echo '{ + "project_name": "Spoolman", + "project_owner": "Donkie", + "version": "${{ github.ref_name }}" + }' > release_info.json + + # Remove client source and keep only the built dist + - name: Clean + run: | + mv client/dist dist + rm -rf client + mkdir client + mv dist client/dist + + - name: Zip + run: | + zip -r spoolman.zip * + + - name: Create release and upload build + uses: softprops/action-gh-release@v1 + id: create-release + with: + draft: true + name: ${{ github.ref_name }} + tag_name: ${{ github.ref_name }} + files: ./spoolman.zip + body: "⚠️ TODO ⚠️" diff --git a/.github/workflows/trigger-release.yml b/.github/workflows/trigger-release.yml new file mode 100644 index 0000000..fe85b19 --- /dev/null +++ b/.github/workflows/trigger-release.yml @@ -0,0 +1,43 @@ +name: Release Trigger + +on: + workflow_dispatch: + inputs: + bump: + type: choice + description: Version to bump + required: true + default: minor + options: + - micro + - minor + - major + +jobs: + bump-version: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.9" + + - name: Install node + uses: actions/setup-node@v3 + with: + node-version: '20' + + - name: Setup PDM + run: | + pip install pdm pdm-bump + + - name: Bump version + run: | + pdm run bump ${{ github.event.inputs.bump }} + + - name: Push + run: | + git push --follow-tags