From ee021484216cab61a60bcc43ba5f0ee4fb464ab7 Mon Sep 17 00:00:00 2001 From: Feng Date: Fri, 31 Mar 2023 10:13:48 +0200 Subject: [PATCH] add auto-release action --- .github/workflows/main.yml | 61 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..f8430e0 --- /dev/null +++ b/.github/workflows/main.yml @@ -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 +