Skip to content

Release on commit

Release on commit #2

Workflow file for this run

name: Release on commit
on:
push:
branches:
- main
paths-ignore:
- '.github/**'
workflow_dispatch:
jobs:
release:
if: ${{ github.event_name == 'workflow_dispatch' || startsWith(github.event.head_commit.message, 'release-') }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: true
token: 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 # 使用个人访问令牌替代默认的 GITHUB_TOKEN
- name: Archive source code
run: |
git submodule update --init --recursive
zip -r source-code.zip .
- name: Get commit ID
id: get_commit
run: echo "commit_id=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Create Release
id: create_release
uses: actions/create-release@v1
with:
tag_name: v${{ github.run_number }}
release_name: ${{ env.commit_id }}
body: |
Release notes for commit ${{ env.commit_id }}.
draft: false
prerelease: false
token: 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 # 使用个人访问令牌替代默认的 GITHUB_TOKEN
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./source-code.zip
asset_name: source-code.zip
asset_content_type: application/zip
token: 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 # 使用个人访问令牌替代默认的 GITHUB_TOKEN