mirror of
https://github.com/imgfloat/client.git
synced 2026-02-05 03:59:26 +00:00
Conditional publish
This commit is contained in:
28
.github/workflows/ci.yml
vendored
28
.github/workflows/ci.yml
vendored
@@ -12,39 +12,25 @@ jobs:
|
|||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
|
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
lfs: true
|
lfs: true
|
||||||
|
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 20
|
node-version: 20
|
||||||
|
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- name: Fetch tags
|
|
||||||
run: git fetch --tags
|
|
||||||
|
|
||||||
- name: Check version tag
|
- name: Build (publish only on master)
|
||||||
id: version_guard
|
|
||||||
if: github.ref == 'refs/heads/master'
|
|
||||||
shell: bash
|
|
||||||
run: |
|
run: |
|
||||||
VERSION=$(node -p "require('./package.json').version")
|
if [ "${GITHUB_REF}" = "refs/heads/master" ]; then
|
||||||
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
npx electron-builder --publish=always
|
||||||
|
|
||||||
if git rev-parse "v$VERSION" >/dev/null 2>&1; then
|
|
||||||
echo "exists=true" >> $GITHUB_OUTPUT
|
|
||||||
else
|
else
|
||||||
echo "exists=false" >> $GITHUB_OUTPUT
|
npx electron-builder --publish=never
|
||||||
fi
|
fi
|
||||||
- name: Build (no publish)
|
|
||||||
if: github.ref != 'refs/heads/master'
|
|
||||||
run: npx electron-builder --publish=never
|
|
||||||
- name: Build & publish
|
|
||||||
if: github.ref == 'refs/heads/master' && steps.version_guard.outputs.exists == 'false'
|
|
||||||
run: npx electron-builder --publish=always
|
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
- name: Publish skipped
|
|
||||||
if: github.ref == 'refs/heads/master' && steps.version_guard.outputs.exists == 'true'
|
|
||||||
run: echo "Version already released — skipping publish"
|
|
||||||
|
|||||||
Reference in New Issue
Block a user