From 357e9d5397b89018b9cf5952d3cefa8f6a9290c5 Mon Sep 17 00:00:00 2001 From: Jordi Chulia Date: Sat, 2 Jan 2021 16:15:04 +0100 Subject: [PATCH] Create a release github workflow --- .github/actions/create-artifact/action.yml | 13 +++++++ .github/actions/run-tests/action.yml | 6 ++++ .github/workflows/CI.yml | 14 +------- .github/workflows/release.yml | 42 ++++++++++++++++++++++ .gitignore | 2 ++ generate-release-artifact.sh | 3 ++ 6 files changed, 67 insertions(+), 13 deletions(-) create mode 100644 .github/actions/create-artifact/action.yml create mode 100644 .github/actions/run-tests/action.yml create mode 100644 .github/workflows/release.yml create mode 100755 generate-release-artifact.sh diff --git a/.github/actions/create-artifact/action.yml b/.github/actions/create-artifact/action.yml new file mode 100644 index 0000000..64c4449 --- /dev/null +++ b/.github/actions/create-artifact/action.yml @@ -0,0 +1,13 @@ +inputs: + version: + description: "Version" + required: true + +runs: + using: "composite" + steps: + - name: Generate artifact + run: ./generate-release-artifact.sh + shell: bash + + - run: mv vest-release.tar.gz vest-release-${{inputs.version}}.tar.gz diff --git a/.github/actions/run-tests/action.yml b/.github/actions/run-tests/action.yml new file mode 100644 index 0000000..0b52aec --- /dev/null +++ b/.github/actions/run-tests/action.yml @@ -0,0 +1,6 @@ +runs: + using: "composite" + steps: + - name: Run tests + run: build/io.github.jorchube.vest.tests + shell: bash \ No newline at end of file diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index be1b540..0225133 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -1,33 +1,21 @@ -# This is a basic workflow to help you get started with Actions - name: Tests -# Controls when the action will run. on: - # Triggers the workflow on push or pull request events but only for the main branch push: pull_request: branches: [ main ] - # Allows you to run this workflow manually from the Actions tab workflow_dispatch: -# A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: - # This workflow contains a single job called "build" unit-tests: - # The type of runner that the job will run on runs-on: ubuntu-20.04 - # Steps represent a sequence of tasks that will be executed as part of the job steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v2 - uses: ./.github/actions/prepare-host - uses: ./.github/actions/build - # Runs a single command using the runners shell - - name: Run tests - run: build/io.github.jorchube.vest.tests + - uses: ./.github/actions/run-tests \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..9c0baf4 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,42 @@ +name: Release + +on: + workflow_dispatch: + inputs: + major-number: + description: "Major version number" + required: true + minor-number: + description: "Minor version number" + required: true + revision-number: + description: "Revision version number" + required: true + +jobs: + make-release: + runs-on: ubuntu-20.04 + + steps: + - uses: actions/checkout@v2 + + - uses: ./.github/actions/prepare-host + + - uses: ./.github/actions/build + + - uses: ./.github/actions/run-tests + + - uses: ./.github/actions/create-artifact + with: + version: ${{major-number}}.${{minor-number}}.${{revision-number}} + + - name: Create Release + uses: ncipollo/release-action@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + artifacts: "vest-release-*.tar.gz" + commit: main + tag: ${{major-number}}.${{minor-number}}.${{revision-number}} + + + \ No newline at end of file diff --git a/.gitignore b/.gitignore index 7e6605e..b0ae30d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ build +vest-release.tar.gz + !.github/actions/build \ No newline at end of file diff --git a/generate-release-artifact.sh b/generate-release-artifact.sh new file mode 100755 index 0000000..2989b78 --- /dev/null +++ b/generate-release-artifact.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +tar cvzf vest-release.tar.gz build/io.github.jorchube.vest.h build/libio.github.jorchube.vest.a build/io.github.jorchube.vest.vapi templates \ No newline at end of file