Update script #4
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: "build" | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
jobs: | |
publish-themes: | |
permissions: | |
contents: write | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- platform: "ubuntu-22.04" | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Generate manifest | |
run: python3 gen-manifest.py | |
- name: Get release name | |
id: date | |
run: | | |
echo "{release_name}={Themes release ($(date +'%Y-%m-%d'))}" >> $GITHUB_STATE | |
- name: Create Release | |
uses: actions/github-script@v2 | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
console.log('environment', process.versions); | |
const fs = require('fs').promises; | |
const { repo: { owner, repo }, sha } = context; | |
console.log({ owner, repo, sha }); | |
const release = await github.repos.createRelease({ | |
owner, repo, | |
tag_name: `release-${sha}`, | |
draft: false, | |
target_commitish: sha | |
}); | |
console.log('created release', { release }); | |
for (let file of await fs.readdir('./')) { | |
if (file.endsWith('.mstx') || file.endsWith('.json')) { | |
console.log('uploading', file); | |
await github.repos.uploadReleaseAsset({ | |
owner, repo, | |
release_id: release.data.id, | |
name: file, | |
data: await fs.readFile(`./${file}`) | |
}); | |
} | |
} |