Skip to content

[FIX] Fix build.sh and cd-release.yml #2

[FIX] Fix build.sh and cd-release.yml

[FIX] Fix build.sh and cd-release.yml #2

Workflow file for this run

name: Create Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
permissions:
contents: write
jobs:
validate:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Validate version and branch
run: |
TAG_NAME=${{ github.ref_name }}
if [[ ! "$TAG_NAME" =~ ^v3\. ]]; then
echo "Error: Tags on master branch must start with v3."
exit 1
fi
build:
needs: validate
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
release_name: Release ${{ github.ref_name }}
draft: false
prerelease: false
- name: Archive Repository
run: zip -r release.zip . -x '.git/*' '.github/*' '.git*'
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./release.zip
asset_name: release.zip
asset_content_type: application/zip