Skip to content

Commit

Permalink
add auto-release action
Browse files Browse the repository at this point in the history
  • Loading branch information
fengwang committed Mar 31, 2023
1 parent 252fbc8 commit ee02148
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Release on Tag
on:
push:
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
# Pick a branch to generate a new build
branches: [ master ]

jobs:
# We define the commit hash and also create the release just once or there are errors
create-release:
runs-on: ubuntu-latest
outputs:
# We can access this values in the other jobs
upload_url: ${{ steps.create_release.outputs.upload_url }}
version: ${{ steps.get_version.outputs.version }}
#sha_short: ${{ steps.vars.outputs.sha_short }}
steps:
# This enable to get the commit and can be used for nightly or dev builds
#- name: Checkout repo
# uses: actions/checkout@v2
#- name: Declare Commit Hash
# id: vars
# shell: bash
# run: |
# echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
- name: Get the version
id: get_version
run: echo ::set-output name=version::${GITHUB_REF/refs\/tags\//}
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ steps.get_version.outputs.version }}
draft: false
prerelease: false

build-ubuntu:
runs-on: ubuntu-latest
needs: [create-release]
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
submodules: recursive
- name: Package project
run: zip --junk-paths matrix matrix.hpp
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ./matrix.zip
asset_name: matrix-${{ needs.create-release.outputs.version }}.zip
asset_content_type: application/zip

0 comments on commit ee02148

Please sign in to comment.