Skip to content

Update release.yml

Update release.yml #61

Workflow file for this run

name: Release
on:
push:
branches:
- main
workflow_dispatch:
inputs:
is_nightly:
description: "Is nightly"
required: false
default: true
type: boolean
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_TERM_COLOR: always
jobs:
# upload-artifacts:
# uses: ./.github/workflows/upload_artifacts.yml
publish:
#needs: upload-artifacts
runs-on: ubuntu-latest
env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
# https://github.com/actions/checkout/issues/1471
fetch-tags: false
# must be after checkout because it will remove artifacts
#- uses: actions/download-artifact@v4
- name: Prepare release on Github
run: |
# get the package version from Cargo.toml
echo "PKG_VERSION=$(cargo pkgid | grep -oP '\d+\.\d+\.\d+')" >> $GITHUB_ENV
# delete nightly release
gh release delete nightly --yes || true
git push --delete origin nightly || true
# in case is_nightly is not defined
- if: ${{ (github.event.inputs.is_nightly == 'true') || (github.event.inputs.is_nightly == '') }}
name: Setup options for nightly
run: |
echo "TAG_NAME=nightly" >> $GITHUB_ENV
echo "PRERELEASE=--prerelease" >> $GITHUB_ENV
- if: ${{ github.event.inputs.is_nightly == 'false' }}
name: Setup options for a new release
run: |
echo "TAG_NAME=v${{ env.PKG_VERSION }}" >> $GITHUB_ENV
- name: Publish release
run: |
git tag ${{ env.TAG_NAME }}
git push origin --tags
# https://cli.github.com/manual/gh_release_create
gh release create ${{ env.TAG_NAME }} --title "${{ env.TAG_NAME }}" \
--verify-tag ${{ env.PRERELEASE }} --generate-notes --target $GITHUB_SHA \
./fan-control*/*