Skip to content

Commit

Permalink
feat: add release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
cafadev committed Sep 4, 2023
1 parent ed588fa commit 4a2b133
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- name: Install deps
run: poetry install

- name: Run Dagger pipeline
- name: Run matic-release
run: poetry run python main.py

- name: Publish tag
Expand Down
49 changes: 31 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
name: Pre-release version
name: Release version

on:
push:
branches: [main]

jobs:
publish:
compute-new-tag-version:
timeout-minutes: 15
runs-on: ubuntu-latest
outputs:
fromTag: ${{ steps.fromTag.outputs.tag }}
toTag: ${{ steps.toTag.outputs.tag }}
steps:
- name: checkout code repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: 'Get Previous tag'
id: fromTag
Expand All @@ -29,32 +34,40 @@ jobs:
- name: Install deps
run: poetry install

- name: Run Dagger pipeline
run: poetry run python ci.py
- name: Run matic-release
run: poetry run python main.py

- name: Publish tag
run: git push --tags

- name: 'Get lastest tag'
id: toTag
uses: "WyriHaximus/github-action-get-previous-tag@v1"

- name: Build Changelog
id: github_release
uses: mikepenz/release-changelog-builder-action@v3

generate-release:
runs-on: ubuntu-latest
needs: compute-new-tag-version
if: ${{ needs.compute-new-tag-version.outputs.fromTag != needs.compute-new-tag-version.outputs.toTag }}
steps:
- name: checkout code repository
uses: actions/checkout@v3
with:
toTag: ${{ steps.toTag.outputs.tag }}
configuration: "changelog-config.json"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0

- name: Set up git-cliff
uses: kenji-miyake/setup-git-cliff@v1

- name: Echo Changelog
env:
CHANGELOG: ${{ steps.github_release.outputs.changelog }}
run: echo "$CHANGELOG"
- name: Run git-cliff
run: |
{
echo 'CHANGELOG<<EOF'
git cliff --latest
echo EOF
} >> "$GITHUB_ENV"
- name: Create Release
uses: softprops/action-gh-release@v1
with:
body: ${{ steps.github_release.outputs.changelog }}
tag_name: ${{ steps.toTag.outputs.tag }}
body: ${{ env.CHANGELOG }}
prerelease: false
tag_name: ${{ needs.compute-new-tag-version.outputs.toTag }}

0 comments on commit 4a2b133

Please sign in to comment.