Skip to content

Pixels 0.1.0

Pixels 0.1.0 #8

Workflow file for this run

# System Release Workflow
# Useful References:
# - https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
# - https://docs.github.com/en/actions/learn-github-actions/contexts
# - https://docs.github.com/en/actions/learn-github-actions/environment-variables
# - https://docs.github.com/en/actions/using-workflows/triggering-a-workflow
# - https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows
# - https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on
name: System Release Build
env:
node_version: 18
project_url: "https://github.com/${{github.repository}}"
latest_manifest_url: "https://github.com/${{github.repository}}/releases/latest/download/module.json"
release_module_url: "https://github.com/${{github.repository}}/releases/download/${{github.event.release.tag_name}}/module.zip"
on:
release:
types: [published]
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install node
uses: actions/setup-node@v2
with:
node-version: ${{ env.node_version }}
- name: Cache Node.js modules
uses: actions/cache@v2
with:
path: .npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
${{ runner.OS }}-
- name: Install dependencies
run: npm ci --cache .npm --prefer-offline
# Extract version number from the release tag
# Release tags need the format "0.0.0" or "v0.0.0"
- name: Extract Version From Tag
id: get_version
uses: battila7/get-version-action@v2
# Modify "module.json" with values specific to the release.
- name: Modify Module Manifest With Release-Specific Values
id: sub_manifest_link_version
uses: cschleiden/replace-tokens@v1
with:
files: 'module.json'
env:
VERSION: ${{steps.get_version.outputs.version-without-v}}
URL: ${{ env.project_url }}
MANIFEST: ${{ env.latest_manifest_url }}
DOWNLOAD: ${{ env.release_module_url }}
# Create a "module.zip" archive containing all the system's required files.
- name: Create Module Archive
run: |
zip --recurse-paths ./module.zip \
module.json \
README.md \
LICENSE \
node_modules/ \
scripts/ \
styles/ \
templates/ \
ui/
# Update the GitHub release with the manifest and system archive files.
- name: Update Release With Files
id: create_version_release
uses: ncipollo/release-action@v1
with:
allowUpdates: true
name: ${{ github.event.release.name }}
draft: ${{ github.event.release.unpublished }}
prerelease: ${{ github.event.release.prerelease }}
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: './module.json, ./module.zip'
tag: ${{ github.event.release.tag_name }}
body: ${{ github.event.release.body }}