Build and Deploy on Release #10
Workflow file for this run
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 and Deploy on Release | |
on: | |
release: | |
types: [published] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "20" | |
- name: Install dependencies | |
run: npm install | |
- name: Run build | |
run: npm run build | |
- name: Configure git | |
run: | | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "[email protected]" | |
- name: Add and commit dist/nous-chat.js | |
run: | | |
git add dist/nous-chat.js | |
git commit -m "Add dist/nous-chat.js from release build" | |
git push origin HEAD:${{ github.ref }} | |
- name: Push changes | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: git push | |
- name: Upload dist/nous-chat.js to release | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.PERSONAL_GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: dist/nous-chat.js | |
asset_name: nous-chat.js | |
asset_content_type: application/javascript |