Skip to content

2.2.1

2.2.1 #55

Workflow file for this run

on:
push:
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
name: Create Release
jobs:
check_current_branch:
runs-on: ubuntu-latest
outputs:
branch: ${{ steps.check_step.outputs.branch }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get current branch
id: check_step
# 1. Get the list of branches ref where this tag exists
# 2. Remove 'origin/' from that result
# 3. Put that string in output
# => We can now use function 'contains(list, item)''
run: |
raw=$(git branch -r --contains ${{ github.ref }})
branch="$(echo ${raw//origin\//} | tr -d '\n')"
echo "{name}=branch" >> $GITHUB_OUTPUT
echo "Branches where this tag exists : $branch."
build:
name: Create Release
runs-on: ubuntu-latest
# Wait for check step to finish
needs: check_current_branch
# only run if tag is present on branch 'main'
if: contains(${{ needs.check_current_branch.outputs.branch }}, 'main')
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get the version
id: get_version
run: echo "FULLVERSION=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT"
- id: set_vars
run: |
FULLVERSION=${{ steps.get_version.outputs.FULLVERSION }}
echo "ZIPURL=${{ github.server_url }}/${{ github.repository }}/releases/download/${FULLVERSION}/touch-vtt-${FULLVERSION}.zip" >> "$GITHUB_OUTPUT"
echo "MODULEJSONURL=${{ github.server_url }}/${{ github.repository }}/releases/download/${FULLVERSION}/module.json" >> "$GITHUB_OUTPUT"
echo "VERSION=${FULLVERSION#v}" >> $GITHUB_OUTPUT
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Update module.json
uses: restackio/[email protected]
with:
file: module.json
fields: "{\"version\": \"${{ steps.set_vars.outputs.VERSION }}\", \"download\": \"${{ steps.set_vars.outputs.ZIPURL }}\"}"
- name: Build Project
run: |
npm install
npm run build
zip touch-vtt-${{ steps.get_version.outputs.FULLVERSION }}.zip module.json dist/* lang/* templates/*
- name: Create Release And Upload Asset
id: create-release-upload
uses: softprops/action-gh-release@v2
with:
draft: false
prerelease: false
tag_name: ${{ steps.get_version.outputs.FULLVERSION }}
name: ${{ steps.get_version.outputs.FULLVERSION }}
files: |
touch-vtt-${{ steps.get_version.outputs.FULLVERSION }}.zip
module.json