fix release zip file content and name #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 and Release | |
on: | |
push: | |
branches: main | |
tags: | |
- "v*.*" | |
jobs: | |
buildAndRelease: | |
runs-on: ubuntu-latest | |
permissions: | |
# needed for creating a release | |
contents: write | |
# needed for pushing docker image | |
attestations: write | |
id-token: write | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: latest | |
- name: Install Npm dependencies | |
run: npm install | |
- name: Run build script | |
run: node build.mjs | |
- name: Zip the out directory | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: | | |
cd out | |
zip -r ../${{ github.repository }}-${{ github.ref_name }}.zip * | |
- name: Create GitHub Release | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/v') | |
with: | |
name: Release ${{ github.ref_name }} | |
draft: false | |
prerelease: false | |
#body_path: CHANGELOG.md | |
files: | | |
${{ github.repository }}-${{ github.ref_name }}.zip | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build Docker image | |
run: | | |
docker build -t ghcr.io/${{ github.repository }}:${{ github.ref_name }} . | |
- name: Log in to GitHub Container Registry | |
uses: docker/login-action@v3 | |
if: startsWith(github.ref, 'refs/tags/v') | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push Docker image | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: | | |
docker push ghcr.io/${{ github.repository }}:${{ github.ref_name }} |