Skip to content

fix tag release flow #15

fix tag release flow

fix tag release flow #15

Workflow file for this run

on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+'
name: ci-tag
jobs:
# Pre-job to find the latest tag
get-latest-tag:
runs-on: ubuntu-latest
timeout-minutes: 2
outputs:
latest-tag: ${{ steps.latest-tag.outputs.tag }}
steps:
- name: Find latest tag
id: latest-tag
uses: oprypin/find-latest-tag@v1
continue-on-error: true
with:
repository: ${{ github.repository }}
# Ignore preview or RC tags when searching for the latest
regex: '^[0-9]+.[0-9]+.[0-9]+$'
releases-only: false
- name: Set output
run: echo "latest-tag=${{ steps.latest-tag.outputs.tag }}"
# Pre-job to find the latest RC tag
get-latest-rc-tag:
runs-on: ubuntu-latest
timeout-minutes: 2
outputs:
latest-rc: ${{ steps.latest-rc.outputs.tag }}
steps:
- name: Find latest RC tag
id: latest-rc
uses: oprypin/find-latest-tag@v1
continue-on-error: true
with:
repository: ${{ github.repository }}
regex: '^[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+$'
releases-only: false
- name: Set output
run: echo "latest-rc=${{ steps.latest-rc.outputs.tag }}"
# Delegate building and containerizing to a single workflow.
build:
needs: [get-latest-tag, get-latest-rc-tag]
uses: ./.github/workflows/ci-build.yml
with:
platforms: linux/amd64,linux/arm64
latest: ${{ needs.get-latest-tag.outputs.latest-tag == github.ref_name }}
rc: ${{ needs.get-latest-rc-tag.outputs.latest-rc == github.ref_name }}
# Build module base for release assets
build-module-base:
uses: ./.github/workflows/build-module-base.yml
secrets: inherit
# Create a draft GitHub release for stable tags
release:
needs: [build, build-module-base]
runs-on: ubuntu-latest
if: ${{ !contains(github.ref_name, '-rc.') }}
permissions:
contents: write
steps:
- name: Download Windows installer
uses: actions/download-artifact@v8
with:
name: OpenShock_Desktop_Setup
path: artifacts/
- name: Download Linux Photino
uses: actions/download-artifact@v8
with:
name: OpenShock Desktop Photino Linux
path: artifacts/photino-linux/
- name: Download Module Base
uses: actions/download-artifact@v8
with:
name: OpenShock Desktop Module Base
path: artifacts/module-base/
- name: Package release assets
run: |
cd artifacts/photino-linux && zip -r ../OpenShock.Desktop.Photino.Linux.zip . && cd ../..
cd artifacts/module-base && zip -r ../OpenShock.Desktop.Module.Base.zip . && cd ../..
- name: Create draft release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
name: ${{ github.ref_name }}
draft: true
generate_release_notes: true
files: |
artifacts/OpenShock_Desktop_Setup.exe
artifacts/OpenShock.Desktop.Photino.Linux.zip
artifacts/OpenShock.Desktop.Module.Base.zip