Skip to content

Merge pull request #7 from aaronczichon/chore/version-change #7

Merge pull request #7 from aaronczichon/chore/version-change

Merge pull request #7 from aaronczichon/chore/version-change #7

Workflow file for this run

name: Release Plugin
on:
push:
tags:
- "*"
jobs:
define-variables:
name: Defining and extracting Variables
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get_version.outputs.VERSION }}
label: ${{ steps.get_label.outputs.LABEL }}
pre_release: ${{ steps.prerelease_check.outputs.PRE_RELEASE }}
steps:
- uses: actions/checkout@v3
- name: Get Version
id: get_version
# E.g. converts ref/tags/0.0.1 -> 0.0.1
run: echo "VERSION=$(echo $GITHUB_REF | sed 's#ref/tags/##')" >> $GITHUB_OUTPUT
- name: Get Label
id: get_label
# E.g. converts 0.0.1-beta.1 -> beta
run: echo "LABEL=$(echo ${{ steps.get_version.outputs.VERSION }} | awk -F '-' '{split($2, arr, "."); print arr[1]}')" >> $GITHUB_OUTPUT
- name: Check for Pre-Release or Release
id: prerelease_check
# perform secret check & put boolean result as an output
run: |
if [ "${{ steps.get_label.outputs.LABEL }}" != '' ]; then
echo "PRE_RELEASE=true" >> $GITHUB_OUTPUT
else
echo "PRE_RELEASE=false" >> $GITHUB_OUTPUT
fi
create-release:
needs: [define-variables]
name: Create Github Release
if: needs.define-variables.outputs.pre_release == 'false'
runs-on: ubuntu-latest
env:
NPM_PACKAGE_VERSION: ${{ needs.define-variables.outputs.version }}
steps:
- uses: actions/checkout@v3
- name: Build Plugin
run: |
npm install
npm run build
npm run version
- uses: "marvinpinto/action-automatic-releases@latest"
name: Publish Release
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
title: ${{ needs.define-variables.outputs.version }}
files: |
main.js
manifest.json
styles.css
create-prerelease:
needs: [define-variables]
name: Create Github Pre-Release
if: needs.define-variables.outputs.pre_release == 'true'
runs-on: ubuntu-latest
env:
NPM_PACKAGE_VERSION: ${{ needs.define-variables.outputs.version }}
steps:
- uses: actions/checkout@v3
- name: Build Plugin
run: |
npm install
npm run build
npm run version
- uses: "marvinpinto/action-automatic-releases@latest"
name: Publish Release
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: true
title: ${{ needs.define-variables.outputs.version }}
files: |
main.js
manifest.json
styles.css