Release on commit #1
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: 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: recursive | |
- 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: ${{ secrets.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: ${{ secrets.GITHUB_TOKEN }} |