Skip to content

Commit

Permalink
Remove workflow (wiiznokes#159)
Browse files Browse the repository at this point in the history
* new release !log

* new release !log

* new release !log

* new release !log

* f

* Update release.yml

* new release !log

* q

* ff
  • Loading branch information
wiiznokes authored Aug 23, 2024
1 parent d59800a commit cecf34f
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 115 deletions.
114 changes: 4 additions & 110 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,138 +1,32 @@
name: Release

on:
workflow_dispatch:
release:
types: [created]

permissions:
contents: write
pull-requests: write

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_TERM_COLOR: always

jobs:
ci:
uses: ./.github/workflows/ci.yml

commit-changes:
needs:
- ci

runs-on: ubuntu-latest

outputs:
version: ${{ steps.identify.outputs.version }}

steps:
- uses: actions/checkout@v4
with:
# https://github.com/actions/checkout/issues/1471
fetch-tags: true
fetch-depth: 0

- uses: taiki-e/install-action@v2
with:
tool: changelog-gen

- name: Set Github env
run: |
echo "version="$(date +"%-y.%-m.%-d")"" >> $GITHUB_ENV
echo "release_date="$(date +"%Y-%m-%d")"" >> $GITHUB_ENV
- id: identify
run: |
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
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
title: "Automatic Release Notes Generation"
base: master
branch: changelog_release
commit-message: "chore(changelog): automatic release generation (skip changelog) [skip ci]"
body: ""
delete-branch: true
# branch-suffix: short-commit-hash

upload-artifacts:
needs:
- commit-changes
uses: ./.github/workflows/upload_artifacts.yml
with:
ref: changelog_release
ref: ${{ github.ref_name }}

release-on-github:
needs:
- upload-artifacts
- commit-changes

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
ref: changelog_release

# 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: |
# try to not break this action
gh release delete ${{ needs.commit-changes.outputs.version }} || true
git fetch --tags || true
git tag -d ${{ github.event.inputs.tag }} || true
git tag ${{ github.event.inputs.tag }} || true
git push origin --tags || true
changelog-gen show > RELEASE_CHANGELOG.md
# https://cli.github.com/manual/gh_release_create
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: changelog_release

- 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 }}
gh release upload ${{ github.ref_name }} ./fan-control*/*
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,6 @@ build/
/repo
/flatpak-out
package-lock.json

/RELEASE_CHANGELOG.md
/io.github.wiiznokes.fan-control
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ repository.workspace = true
keywords.workspace = true

[package.metadata.packager]
version = "24.8.22"
version = "24.8.23"
before-each-package-command = "cargo build --release"
identifier = "io.github.wiiznokes.fan-control"
icons = ["res/windows/app_icon.ico"]
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
24.8.22
24.8.23
52 changes: 50 additions & 2 deletions new_release.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
#!/bin/bash
#!/bin/bash -ex

cargo test --workspace --all-features

cargo fmt --all --check --verbose

cargo clippy --workspace --all-features

NEW_VERSION="$(date +"%-y.%-m.%-d")"

Expand All @@ -8,4 +14,46 @@ sed -i '/<release /s/version="[^"]*"/version="'"$NEW_VERSION"'"/; /<release /s/d

sed -i '/\[package.metadata.packager\]/,/^$/s/version = ".*"/version = "'"$NEW_VERSION"'"/' "Cargo.toml"

echo $NEW_VERSION > VERSION
echo $NEW_VERSION >VERSION

changelog-gen generate --repo "wiiznokes/changelog-generator" --exclude-unidentified
changelog-gen release --version $NEW_VERSION

git add .
git commit -m "new release !log"
git push

gh release delete $NEW_VERSION -y || true
git tag -d $NEW_VERSION || true
git push origin --delete $NEW_VERSION || true
git tag $NEW_VERSION
git push origin $NEW_VERSION

changelog-gen show >RELEASE_CHANGELOG.md

SHA="$(git rev-parse $NEW_VERSION)"

gh release create $NEW_VERSION --title $NEW_VERSION \
--notes-file RELEASE_CHANGELOG.md --target $SHA


rm -rf io.github.wiiznokes.fan-control

git clone https://github.com/flathub/io.github.wiiznokes.fan-control

cd io.github.wiiznokes.fan-control

git branch -d new_release || true
git push origin --delete new_release || true

git checkout -b new_release

just

git add .

git commit -m "new release"

git push -u origin new_release

gh pr create --base master --head new_release --title "New release" --body ""
2 changes: 1 addition & 1 deletion res/linux/metainfo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
</screenshots>

<releases>
<release version="24.8.22" date="2024-08-22">
<release version="24.8.23" date="2024-08-23">
<url type="details">
https://github.com/wiiznokes/fan-control/blob/master/CHANGELOG.md</url>
</release>
Expand Down

0 comments on commit cecf34f

Please sign in to comment.