Skip to content

Commit

Permalink
fix(ci): update release yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
songkg7 committed Jan 22, 2024
1 parent 178b9e4 commit 76964a1
Showing 1 changed file with 47 additions and 22 deletions.
69 changes: 47 additions & 22 deletions .github/workflows/auto-release.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,68 @@
---
name: Release O2
name: Build plugin

on:
workflow_dispatch:
push:
tags:
- '*'
branches:
- main

env:
PLUGIN_NAME: o2

jobs:
build:
if: contains(github.ref, 'refs/tags/')
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18

- name: Environment details
run: npm version
- name: Build
id: build
run: |
npm install
npm ci
npm run build
- name: Release
id: release
uses: softprops/action-gh-release@v1
mkdir ${{ env.PLUGIN_NAME }}
cp main.js manifest.json ${{ env.PLUGIN_NAME }}
zip -r ${{ env.PLUGIN_NAME }}.zip ${{ env.PLUGIN_NAME }}
ls
echo "tag_name=$(git tag --sort version:refname | tail -n 1)" >> $GITHUB_OUTPUT
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: false
prerelease: false
token: ${{ secrets.GITHUB_TOKEN }}
generate_release_notes: true
files: |
main.js
manifest.json
styles.css
- name: Upload zip file
id: upload-zip
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./${{ env.PLUGIN_NAME }}.zip
asset_name: ${{ env.PLUGIN_NAME }}-${{ steps.build.outputs.tag_name }}.zip
asset_content_type: application/zip
- name: Upload main.js
id: upload-main
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./main.js
asset_name: main.js
asset_content_type: text/javascript
- name: Upload manifest.json
id: upload-manifest
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./manifest.json
asset_name: manifest.json
asset_content_type: application/json

0 comments on commit 76964a1

Please sign in to comment.