From dbd47b0558839fb8f7b1e9de781cd4468a112dd6 Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Tue, 19 May 2020 12:06:56 -0300 Subject: [PATCH] Added release workflow --- .github/workflows/release.yml | 80 +++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..d1d7ac7a --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,80 @@ +name: release + +on: + push: + tags: + - "v*" + +jobs: + check: + runs-on: ubuntu-latest + outputs: + is_tag: ${{ steps.check.outputs.is_tag }} + + steps: + - name: Check if it's a tagged release + id: check + run: | + REF=${{ github.ref }} + URL="https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/tags/${REF##*/}" + StatusCode=$(curl -o -I -L -s -w "%{http_code}" -X GET -G $URL) + echo $StatusCode + if [[ "$StatusCode" == 200 ]]; then + echo "This is tagged release!" + echo "::set-output name=is_tag::no" + else + echo "This is a tag not release!" + echo "::set-output name=is_tag::yes" + fi + + build: + runs-on: ubuntu-latest + container: setsoft/kicad_pybuild:latest + needs: check + if: ${{ needs.check.outputs.is_tag == 'yes' }} + outputs: + deb_name: ${{ steps.mdeb.outputs.deb_name }} + + steps: + - name: Checkout + uses: actions/checkout@v1 + + - name: Build + id: mdeb + run: | + make deb + mv ../*.deb . + echo "::set-output name=deb_name::"`ls *.deb` + mkdir output + mv *.deb output + + - name: Store + uses: actions/upload-artifact@v1 + with: + name: package + path: output + + release: + needs: build + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v1 + + - name: Retrieve + uses: actions/download-artifact@v1 + with: + name: package + + - name: Release + uses: docker://antonyurchenko/git-release:latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + DRAFT_RELEASE: "false" + PRE_RELEASE: "false" + CHANGELOG_FILE: "CHANGELOG.md" + ALLOW_TAG_PREFIX: "true" + with: + args: | + package/${{needs.build.outputs.deb_name}} +