Initial commit #1
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
name: Create Release | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- "*.*.*" | |
permissions: | |
contents: write | |
pull-requests: write | |
env: | |
PLUGIN_JSON: "0.0.1" | |
TAG_EXISTS: false | |
PLUGIN_NAME: "my_plugin" | |
jobs: | |
# This will be deleted by setup.py | |
check: | |
runs-on: ubuntu-latest | |
outputs: | |
plugin_name: ${{ steps.init.outputs.plugin_name }} | |
steps: | |
- name: Get plugin name | |
id: init | |
run: | | |
echo "plugin_name=${{ env.PLUGIN_NAME }}" >> $GITHUB_OUTPUT | |
# This is the end of the removed section | |
release: | |
# This will be deleted by setup.py | |
needs: check | |
if: startsWith(needs.check.outputs.plugin_name, 'MY_PLUGIN') == false | |
# This is the end of the removed section | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Get plugin version | |
run: | | |
echo 'PLUGIN_JSON<<EOF' >> $GITHUB_ENV | |
cat ./plugin.json >> $GITHUB_ENV | |
echo 'EOF' >> $GITHUB_ENV | |
- name: Publish tag | |
if: env.TAG_EXISTS == false | |
uses: rickstaa/action-create-tag@v1 | |
with: | |
tag: "${{fromJson(env.PLUGIN_JSON).version}}" | |
tag_exists_error: false | |
message: "Latest release" | |
- name: Zip release | |
uses: TheDoctor0/[email protected] | |
with: | |
type: 'zip' | |
filename: '${{env.PLUGIN_NAME}}.zip' | |
exclusions: '*.git* setup.py' | |
directory: '.' | |
path: '.' | |
- name: Upload release | |
uses: ncipollo/[email protected] | |
with: | |
tag: "${{fromJson(env.PLUGIN_JSON).version}}" | |
artifacts: '${{env.PLUGIN_NAME}}.zip' | |
allowUpdates: true | |
replacesArtifacts: true | |
body: | | |
${{ github.event.head_commit.message }} | |
token: ${{ secrets.GITHUB_TOKEN }} |