Updated actiont to run on commit

This commit is contained in:
Loup-Garou911XD 2024-04-20 04:26:43 +05:30
parent a30d298e20
commit 281459cac1
4 changed files with 86 additions and 32 deletions

View file

@ -2,44 +2,56 @@ name: Create Release
on:
push:
tags:
- v1.*
paths:
- index.json
jobs:
build:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- run: |
output=$(python3 test/get_changes.py "${{ github.ref }}")
echo "::set-output name=changelog::$output"
id: set_changelog
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
- name: 'Get Previous tag'
uses: oprypin/find-latest-tag@v1.1.2
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
repository: ${{ github.repository }}
releases-only: true # We know that all relevant tags have a GitHub release for them.
id: previoustag
- name: set_variables
run: |
output1=$(python3 test/get_latest.py)
output2=$(python3 test/get_changes.py "$output1")
output3=$(python3 test/version_is_lower.py ${{ steps.previoustag.outputs.tag }})
echo "latestVersion=$output1" >> $GITHUB_OUTPUT
echo "changelog=$output2" >> $GITHUB_OUTPUT
echo "shouldRun=$output3" >> $GITHUB_OUTPUT
id: set_variables
- name: Bump version and push tag
if: ${{ steps.set_variables.outputs.shouldRun == '1' }}
id: tag_version
uses: mathieudutour/github-tag-action@v6.2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
custom_tag: |
${{ steps.set_variables.outputs.latestVersion }}
- name: Create release
if: ${{ steps.tag_version.outputs.new_tag }}
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.tag_version.outputs.new_tag }}
name: Release ${{ steps.tag_version.outputs.new_tag }}
artifacts: "plugin_manager.py"
body: |
## Changelog
${{ steps.set_changelog.outputs.changelog }}
draft: false
prerelease: false\
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./plugin_manager.py
asset_name: plugin_manager.py
asset_content_type: application
${{ steps.set_variables.outputs.changelog }}