2023-05-12 10:22:25 -04:00
|
|
|
name: Releases
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
2023-05-13 12:45:59 -04:00
|
|
|
- "rolling"
|
2023-05-12 10:22:25 -04:00
|
|
|
|
|
|
|
concurrency:
|
2023-05-12 13:16:37 -04:00
|
|
|
group: "rolling-branch"
|
2023-05-12 10:22:25 -04:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
changelog:
|
2023-05-12 13:16:37 -04:00
|
|
|
if: github.repository == 'neon-mmd/websurfx'
|
2023-05-12 10:22:25 -04:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
# Create a temporary, uniquely named branch to push release info to
|
|
|
|
- name: create temporary branch
|
|
|
|
uses: peterjgrainger/action-create-branch@v2.3.0
|
|
|
|
id: create-branch
|
|
|
|
with:
|
|
|
|
branch: "release-from-${{ github.sha }}"
|
|
|
|
sha: "${{ github.sha }}"
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
|
|
|
# check out the repository afterwards
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
|
|
|
|
# fetch branches and switch to the temporary branch
|
|
|
|
- name: switch to new branch
|
|
|
|
run: git fetch --all && git checkout --track origin/release-from-${{ github.sha }}
|
|
|
|
|
|
|
|
# update app config with version
|
2023-05-15 05:34:39 -04:00
|
|
|
- name: Get current rust app version from its Cargo.toml.
|
|
|
|
id: foo
|
|
|
|
uses: dante-signal31/rust-app-version@v1.2.0
|
|
|
|
with:
|
|
|
|
cargo_toml_folder: rust_app_folder/
|
|
|
|
|
|
|
|
- name: Use the version to update the Cargo.toml version.
|
|
|
|
shell: bash
|
|
|
|
run: sed -i "3s/version = \"[0-9]*.[0-9]*.[0-9]*\"/version = \"${{ steps.foo.outputs.app_version }}\"/g" Cargo.toml
|
2023-05-12 10:22:25 -04:00
|
|
|
|
|
|
|
# create release info and push it upstream
|
|
|
|
- name: conventional Changelog Action
|
|
|
|
id: changelog
|
|
|
|
uses: TriPSs/conventional-changelog-action@v3
|
|
|
|
with:
|
|
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
2023-05-12 13:16:37 -04:00
|
|
|
version-file: "./Cargo.toml"
|
2023-05-12 10:22:25 -04:00
|
|
|
git-branch: "release-from-${{ github.sha }}"
|
|
|
|
skip-on-empty: false
|
|
|
|
skip-git-pull: true
|
|
|
|
|
|
|
|
# create PR using GitHub CLI
|
|
|
|
- name: create PR with release info
|
|
|
|
id: create-pr
|
2023-05-12 13:16:37 -04:00
|
|
|
run: gh pr create --base main --head release-from-${{ github.sha }} --title 'Merge new release into rolling' --body 'Created by Github action'
|
2023-05-12 10:22:25 -04:00
|
|
|
env:
|
|
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
|
|
|
# merge PR using GitHub CLI
|
|
|
|
- name: merge PR with release info
|
|
|
|
id: merge-pr
|
|
|
|
run: gh pr merge --admin --merge --subject 'Merge release info' --delete-branch
|
|
|
|
env:
|
|
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
|
|
|
# release info is now in main so we can continue as before
|
|
|
|
- name: create release with last commit
|
|
|
|
uses: actions/create-release@v1
|
|
|
|
if: steps.changelog.outputs.skipped == 'false'
|
|
|
|
env:
|
2023-05-13 12:16:15 -04:00
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2023-05-12 10:22:25 -04:00
|
|
|
with:
|
|
|
|
tag_name: ${{ steps.changelog.outputs.tag }}
|
|
|
|
release_name: ${{ steps.changelog.outputs.tag }}
|
|
|
|
body: ${{ steps.changelog.outputs.clean_changelog }}
|