Skip to content

Commit

Permalink
cleanup and action file
Browse files Browse the repository at this point in the history
  • Loading branch information
Phoebe authored and Phoebe committed Feb 11, 2024
1 parent 4eee6e9 commit 5d7c7dc
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 1,185 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Build and Deploy
on:
push:
branches:
- master
- gh-pages
jobs:
build-and-deploy:
runs-on: ubuntu-latest
Expand Down
104 changes: 104 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: Release

on:
push:
branches:
- master

defaults:
run:
shell: bash

env:
IS_COOL: true

jobs:
build:
name: Create a new release
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- uses: denoland/setup-deno@v1
with:
deno-version: v1.x

- name: Build parser standalone JS
working-directory: ./parser
run: deno task bundle

- name: Build parser binaries
working-directory: ./parser
run: deno task release:all

- name: Copy files to release
run: |
mkdir -p release
cp -r parser/build/* release/
- name: Build docs with Deno
working-directory: ./docs
run: deno task build

- name: Zip dist folder
working-directory: ./docs/dist
run: zip -r ../../release/docs.zip *

- 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: process.env.GITHUB_REF,
draft: true,
target_commitish: sha
});
console.log('created release', { release });
const releaseFiles = await fs.readdir('./release');
for (let file of releaseFiles) {
// do whatever filtering you want here, I'm just uploading all the files
console.log('uploading', file);
await github.repos.uploadReleaseAsset({
owner, repo,
release_id: release.data.id,
name: file,
data: await fs.readFile(`./release/${file}`)
});
}
# - name: Create Release
# id: create_release
# uses: actions/create-release@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # provided by Actions, no need to create
# with:
# tag_name: ${{ github.ref }}
# release_name: Release ${{ github.ref }}
# body: Release of version ${{ github.ref }}. # TODO: generate from CHANGELOG.md file ?
# draft: false
# prerelease: false

# - name: Upload Release Asset
# id: upload-release-asset
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ steps.create_release.outputs.upload_url }} # more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
# asset_path: ./release
# asset_name: parser*
# asset_content_type: application/zip
# asset_content_type: application/octet-stream
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,6 @@ builder/src/parsed.json

# build deno files
*.exe
*.bin
*.bin

docs/dist/
Loading

0 comments on commit 5d7c7dc

Please sign in to comment.