mirror of
https://github.com/nestriness/cdc-file-transfer.git
synced 2026-01-30 14:45:37 +02:00
Improve create_release workflow (#20)
Modifies the create_release workflow in 2 ways: - It only runs now if something is pushed to main. - It creates a tagged release if a tag is pushed. To create a tagged release, run e.g. git tag -a v0.1.0 -m "Release 0.1.0" git push origin v0.1.0
This commit is contained in:
31
.github/workflows/create_release.yml
vendored
31
.github/workflows/create_release.yml
vendored
@@ -1,6 +1,12 @@
|
|||||||
name: Create Release
|
name: Create Release
|
||||||
|
|
||||||
on: [push]
|
on:
|
||||||
|
push:
|
||||||
|
# Note: It's branch main OR tags v*, not AND! Tags are not per-branch.
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
tags:
|
||||||
|
- "v*"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
Build-And-Test-Linux:
|
Build-And-Test-Linux:
|
||||||
@@ -86,16 +92,33 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [Build-And-Test-Windows, Build-And-Test-Linux]
|
needs: [Build-And-Test-Windows, Build-And-Test-Linux]
|
||||||
steps:
|
steps:
|
||||||
|
- name: Test
|
||||||
|
run: echo '${{ toJSON(github) }}'
|
||||||
|
|
||||||
- name: Download artifacts
|
- name: Download artifacts
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v3
|
||||||
|
|
||||||
- name: Zip binaries
|
- name: Zip binaries
|
||||||
run: zip -j binaries_x64.zip Windows-Artifacts/* Linux-Artifacts/*
|
run: |
|
||||||
|
# The ref resolves to "main" for latest and e.g. "v0.1.0" for tagged.
|
||||||
|
BINARIES_ZIP_NAME=cdc-file-transfer-binaries-${GITHUB_REF#refs/*/}-x64.zip
|
||||||
|
echo "BINARIES_ZIP_NAME=$BINARIES_ZIP_NAME" >> $GITHUB_ENV
|
||||||
|
zip -j $BINARIES_ZIP_NAME Windows-Artifacts/* Linux-Artifacts/*
|
||||||
|
|
||||||
- uses: "marvinpinto/action-automatic-releases@latest"
|
- name: Publish latest release
|
||||||
|
if: "!startsWith(github.ref, 'refs/tags/v')"
|
||||||
|
uses: "marvinpinto/action-automatic-releases@latest"
|
||||||
with:
|
with:
|
||||||
repo_token: "${{ secrets.GITHUB_TOKEN }}"
|
repo_token: "${{ secrets.GITHUB_TOKEN }}"
|
||||||
automatic_release_tag: "latest"
|
automatic_release_tag: "latest"
|
||||||
prerelease: true
|
prerelease: true
|
||||||
title: "Development Build"
|
title: "Development Build"
|
||||||
files: binaries_x64.zip
|
files: ${{ env.BINARIES_ZIP_NAME }}
|
||||||
|
|
||||||
|
- name: Publish tagged release
|
||||||
|
if: startsWith(github.ref, 'refs/tags/v')
|
||||||
|
uses: "marvinpinto/action-automatic-releases@latest"
|
||||||
|
with:
|
||||||
|
repo_token: "${{ secrets.GITHUB_TOKEN }}"
|
||||||
|
prerelease: false
|
||||||
|
files: ${{ env.BINARIES_ZIP_NAME }}
|
||||||
|
|||||||
Reference in New Issue
Block a user