forked from wiiznokes/fan-control
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: changelog in CI + remove lazycell & once lock
* remove lazy_static dep * rm once_cell * Update CHANGELOG.md * ff * ff * Update DEV.md * ff * comment ci * Update CHANGELOG.md * g * Update CHANGELOG.md * chore(changelog): automatic release generation (skip changelog) [skip ci] * ff * Update DEV.md * ff * chore(changelog): automatic release generation (skip changelog) [skip ci] --------- Co-authored-by: wiiznokes <[email protected]>
- Loading branch information
Showing
16 changed files
with
280 additions
and
227 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,75 +1,119 @@ | ||
name: Release | ||
|
||
on: | ||
# todo: allow this but should not build if the current HEAD is already tagger with nightly | ||
#schedule: | ||
# run every day | ||
#- cron: 0 0 * * * | ||
workflow_dispatch: | ||
inputs: | ||
is_nightly: | ||
description: "Is nightly" | ||
required: false | ||
default: true | ||
type: boolean | ||
|
||
concurrency: | ||
group: ${{ github.workflow }} | ||
cancel-in-progress: true | ||
permissions: | ||
contents: write | ||
|
||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
upload-artifacts: | ||
uses: ./.github/workflows/upload_artifacts.yml | ||
ci: | ||
uses: ./.github/workflows/ci.yml | ||
|
||
publish: | ||
needs: upload-artifacts | ||
runs-on: ubuntu-latest | ||
commit-changes: | ||
needs: | ||
- ci | ||
|
||
env: | ||
GH_REPO: ${{ github.repository }} | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: write | ||
outputs: | ||
version: ${{ steps.identify.outputs.version }} | ||
|
||
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=$(cat VERSION)" >> $GITHUB_ENV | ||
fetch-tags: true | ||
fetch-depth: 0 | ||
|
||
# delete nightly release | ||
gh release delete nightly --yes || true | ||
git push --delete origin nightly || true | ||
- uses: taiki-e/install-action@v2 | ||
with: | ||
tool: changelog-gen | ||
|
||
# in case is_nightly is not defined | ||
- if: ${{ (github.event.inputs.is_nightly == 'true') || (github.event.inputs.is_nightly == '') }} | ||
name: Setup options for nightly | ||
- name: Set Github env | ||
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 | ||
echo "version="$(date +"%-y.%-m.%-d")"" >> $GITHUB_ENV | ||
echo "release_date="$(date +"%Y-%m-%d")"" >> $GITHUB_ENV | ||
- id: identify | ||
run: | | ||
echo "TAG_NAME=v${{ env.PKG_VERSION }}" >> $GITHUB_ENV | ||
sed -i '/<release /s/version="[^"]*"/version="'"${{ env.version }}"'"/; /<release /s/date="[^"]*"/date="'"${{ env.release_date }}"'"/' "res/linux/metainfo.xml" | ||
sed -i '/\[package.metadata.packager\]/,/^$/s/version = ".*"/version = "'"${{ env.version }}"'"/' "Cargo.toml" | ||
echo ${{ env.version }} > VERSION | ||
changelog-gen generate --exclude-unidentified | ||
changelog-gen release --version ${{ env.version }} | ||
echo "version=${{ env.version }}" >> $GITHUB_OUTPUT | ||
- uses: stefanzweifel/git-auto-commit-action@v5 | ||
with: | ||
commit_message: "chore(changelog): automatic release generation (skip changelog) [skip ci]" | ||
tagging_message: ${{ env.version }} | ||
|
||
upload-artifacts: | ||
needs: | ||
- commit-changes | ||
uses: ./.github/workflows/upload_artifacts.yml | ||
with: | ||
tag: ${{ needs.commit-changes.outputs.version }} | ||
|
||
release-on-github: | ||
needs: | ||
- upload-artifacts | ||
- commit-changes | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
# must be after checkout because it will remove artifacts | ||
- uses: actions/download-artifact@v4 | ||
|
||
- uses: taiki-e/install-action@v2 | ||
with: | ||
tool: changelog-gen | ||
|
||
- name: Publish release | ||
run: | | ||
git tag ${{ env.TAG_NAME }} | ||
git push origin --tags | ||
changelog-gen -- show > RELEASE_CHANGELOG.md | ||
# 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 \ | ||
gh release create ${{ needs.commit-changes.outputs.version }} --title ${{ needs.commit-changes.outputs.version }} \ | ||
--notes-file RELEASE_CHANGELOG.md --target $GITHUB_SHA \ | ||
./fan-control*/* | ||
pr-to-flathub: | ||
needs: | ||
- commit-changes | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: wiiznokes/io.github.wiiznokes.fan-control | ||
ref: master | ||
|
||
- uses: taiki-e/install-action@just | ||
|
||
- run: | | ||
git remote add upstream https://github.com/flathub/io.github.wiiznokes.fan-control | ||
git fetch upstream | ||
git rebase upstream/master | ||
just | ||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v7-rc | ||
with: | ||
title: "Automatic Release" | ||
base: master | ||
branch: release | ||
commit-message: "new release" | ||
body: "" | ||
delete-branch: true | ||
branch-suffix: timestamp | ||
token: ${{ secrets.PAT_FLATHUB }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.