From 1c9e8fe5e2f226e229300e03f606bcd0b0634f6a Mon Sep 17 00:00:00 2001 From: Corey Butler Date: Tue, 31 Mar 2020 23:24:33 -0500 Subject: [PATCH] Rolled back the release scripts. --- .github/FUNDING.yml | 12 +++++ .github/workflows/deploy.yml | 97 ++++++++++++++++++++++++++++++++++++ 2 files changed, 109 insertions(+) create mode 100644 .github/FUNDING.yml create mode 100644 .github/workflows/deploy.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..eaf9b65 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: coreybutler +patreon: # coreybutler +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] \ No newline at end of file diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..d63c6ad --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,97 @@ +name: Tag, Release, & Publish + +on: + push: + branches: + - master + +jobs: + build: + runs-on: ubuntu-latest + steps: + # Checkout updated source code + - uses: actions/checkout@v2 + + # If the version has changed, create a new git tag for it. + - name: Tag + id: autotagger + uses: butlerlogic/action-autotag@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + # The remaining steps all depend on whether or not + # a new tag was created. There is no need to release/publish + # updates until the code base is in a releaseable state. + + # If the new version/tag is a pre-release (i.e. 1.0.0-beta.1), create + # an environment variable indicating it is a prerelease. + - name: Pre-release + if: steps.autotagger.outputs.tagname != '' + run: | + if [[ "${{ steps.autotagger.output.version }}" == *"-"* ]]; then echo "::set-env IS_PRERELEASE=true";else echo "::set-env IS_PRERELEASE=''";fi + + # Create a github release + # This will create a snapshot of the module, + # available in the "Releases" section on Github. + - name: Release + id: create_release + if: steps.autotagger.outputs.tagname != '' + uses: actions/create-release@v1.0.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ steps.autotagger.outputs.tagname }} + release_name: ${{ steps.autotagger.outputs.tagname }} + body: ${{ steps.autotagger.outputs.tagmessage }} + draft: false + prerelease: env.IS_PRERELEASE != '' + + - uses: actions/setup-node@v1 + if: steps.create_release.outputs.id != '' + with: + node-version: '13' + + # Build tarballs of the module code. + - name: Build Release Artifacts + id: build_release + if: steps.create_release.outputs.id != '' + run: | + npm install + cd ./build && npm install && cd ../ + npm run build --if-present + for d in .dist/*/*/ ; do tar -cvzf ${d%%/}-${{ steps.autotagger.outputs.version }}.tar.gz ${d%%}*; done; + if [[ ${{ github.ref }} == *"-"* ]]; then echo ::set-output isprerelease=true;else echo ::set-output isprerelease=false;fi + # Upload tarballs to the release. + - name: Upload Release Artifacts + uses: AButler/upload-release-assets@v2.0 + if: steps.create_release.outputs.id != '' + with: + files: './.dist/**/*.tar.gz' + repo-token: ${{ secrets.GITHUB_TOKEN }} + release-tag: ${{ steps.autotagger.outputs.tagname }} + + # Build npm packages + - name: Build Module Artifacts + id: build_npm + if: steps.create_release.outputs.id != '' + run: | + npm install + cd ./build && npm install && cd ../ + npm run build --if-present + # Use this action to publish a single module to npm. + - name: Publish + id: publish_npm + if: steps.autotagger.outputs.tagname != '' + uses: author/action-publish@master + with: + scan: .dist + env: + REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }} + + - name: Rollback Release + if: failure() && steps.create_release.outputs.id != '' + uses: author/action-rollback@stable + with: + tag: ${{ steps.autotagger.outputs.tagname }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file