ci(release): fix lint + harden release workflow
This commit is contained in:
32
.github/workflows/release-on-version.yml
vendored
32
.github/workflows/release-on-version.yml
vendored
@@ -1,20 +1,19 @@
|
|||||||
---
|
---
|
||||||
name: Release on version.js update
|
name: Release on version.js update
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches: ["master"]
|
||||||
- master
|
|
||||||
paths:
|
paths:
|
||||||
- public/js/version.js
|
- public/js/version.js
|
||||||
workflow_run:
|
workflow_run:
|
||||||
workflows: "Bump version and sync Changelog to Docker Repo"
|
workflows: ["Bump version and sync Changelog to Docker Repo"]
|
||||||
types: completed
|
types: [completed]
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
concurrency:
|
concurrency:
|
||||||
@@ -27,6 +26,10 @@
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Ensure tags available
|
||||||
|
run: |
|
||||||
|
git fetch --tags --force --prune --quiet
|
||||||
|
|
||||||
- name: Read version from version.js
|
- name: Read version from version.js
|
||||||
id: ver
|
id: ver
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -45,7 +48,6 @@
|
|||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
git fetch --tags --quiet
|
|
||||||
if git rev-parse -q --verify "refs/tags/${{ steps.ver.outputs.version }}" >/dev/null; then
|
if git rev-parse -q --verify "refs/tags/${{ steps.ver.outputs.version }}" >/dev/null; then
|
||||||
echo "exists=true" >> "$GITHUB_OUTPUT"
|
echo "exists=true" >> "$GITHUB_OUTPUT"
|
||||||
echo "Tag ${{ steps.ver.outputs.version }} already exists. Skipping release."
|
echo "Tag ${{ steps.ver.outputs.version }} already exists. Skipping release."
|
||||||
@@ -53,13 +55,17 @@
|
|||||||
echo "exists=false" >> "$GITHUB_OUTPUT"
|
echo "exists=false" >> "$GITHUB_OUTPUT"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Build the artifact first so we can checksum it
|
|
||||||
- name: Build zip artifact
|
- name: Build zip artifact
|
||||||
if: steps.tagcheck.outputs.exists == 'false'
|
if: steps.tagcheck.outputs.exists == 'false'
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
zip -r "FileRise-${{ steps.ver.outputs.version }}.zip" public/ README.md LICENSE >/dev/null || true
|
ZIP="FileRise-${{ steps.ver.outputs.version }}.zip"
|
||||||
|
zip -r "$ZIP" . \
|
||||||
|
-x "./.git/*" "./.github/*" \
|
||||||
|
"./resources/*" "./resources/**" \
|
||||||
|
"./.dockerignore" "./.gitattributes" "./.gitignore" \
|
||||||
|
"$ZIP" "${ZIP}.sha256" >/dev/null
|
||||||
|
|
||||||
- name: Compute SHA-256 checksum
|
- name: Compute SHA-256 checksum
|
||||||
if: steps.tagcheck.outputs.exists == 'false'
|
if: steps.tagcheck.outputs.exists == 'false'
|
||||||
@@ -100,8 +106,8 @@
|
|||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
git fetch --tags --quiet
|
VER="${{ steps.ver.outputs.version }}"
|
||||||
PREV=$(git tag --list "v*" --sort=-v:refname | sed -n '2p' || true)
|
PREV=$(git tag --list "v*" --sort=-v:refname | grep -v -F "$VER" | head -n1 || true)
|
||||||
if [[ -z "$PREV" ]]; then
|
if [[ -z "$PREV" ]]; then
|
||||||
PREV=$(git rev-list --max-parents=0 HEAD | tail -n1)
|
PREV=$(git rev-list --max-parents=0 HEAD | tail -n1)
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user