Skip to content

Commit

Permalink
Add workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Toon324 committed Jul 11, 2020
1 parent ad8bb4f commit df55349
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/get-version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
var fs = require('fs');
console.log(JSON.parse(fs.readFileSync('module.json', 'utf8')).version);
45 changes: 45 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Module CI/CD

on: [push]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

# create a zip file with all files required by the module to add to the release
- run: zip -r ./module.zip module.json styles/ tabbed-chatlog.js

# Get the version from 'module.json'
- name: Get Version
shell: bash
id: get-version
run: echo "::set-output name=version::$(node ./.github/workflows/get-version.js)"

# Create a release for this specific version
- name: Create Release
id: create_version_release
uses: ncipollo/release-action@v1
with:
allowUpdates: true # set this to false if you want to prevent updating existing releases
name: Release ${{ steps.get-version.outputs.version }}
draft: false
prerelease: false
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: './module.json,./module.zip'
tag: ${{ steps.get-version.outputs.version }}

# Update the 'latest' release
- name: Create Release
id: create_latest_release
uses: ncipollo/release-action@v1
if: endsWith(github.ref, 'master')
with:
allowUpdates: true
name: Latest
draft: false
prerelease: false
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: './module.json,./module.zip'
tag: latest

0 comments on commit df55349

Please sign in to comment.