From 30f14e13b0a0365dc7758c454f49c1b6d69496e7 Mon Sep 17 00:00:00 2001 From: Matty Stratton Date: Fri, 5 Jan 2024 11:57:07 -0600 Subject: [PATCH] Set up GH actions for releases (#415) Signed-off-by: Matty Stratton --- .circleci/config.yml | 19 +++++--- .github/release.yml | 26 ++++++++++ .github/workflows/prepare-release.yml | 70 +++++++++++++++++++++++++++ .github/workflows/release.yml | 27 +++++++++++ 4 files changed, 134 insertions(+), 8 deletions(-) create mode 100644 .github/release.yml create mode 100644 .github/workflows/prepare-release.yml create mode 100644 .github/workflows/release.yml diff --git a/.circleci/config.yml b/.circleci/config.yml index 4d711081..80b832e4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -97,6 +97,8 @@ jobs: name: "Test grey-row-jumbo" command: cd exampleSite && ls && pwd && HUGO_ENV=production hugo -v -d workspace/test/grey-row-jumbo --config ../test/grey-row-jumbo-config.toml --themesDir ../.. --theme=castanet --buildDrafts=false +# + create-release: docker: - image: cibuilds/github:0.13.0 @@ -125,6 +127,7 @@ jobs: VERSION=${CIRCLE_TAG} ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete ${VERSION} ./release/ +# this is what ends the commented out part # publish-github-release: # docker: @@ -178,11 +181,11 @@ workflows: - test-grey-row-jumbo: requires: - build - deploy: - jobs: - - create-release: - filters: - tags: - only: /^\d+\.\d+\.\d+$/ - branches: - ignore: /.*/ + # deploy: + # jobs: + # - create-release: + # filters: + # tags: + # only: /^\d+\.\d+\.\d+$/ + # branches: + # ignore: /.*/ diff --git a/.github/release.yml b/.github/release.yml new file mode 100644 index 00000000..070d2588 --- /dev/null +++ b/.github/release.yml @@ -0,0 +1,26 @@ +# .github/release.yml + +changelog: + exclude: + labels: + - ignore-for-release + - duplicate + - question + - invalid + - wontfix + - do-not-merge + - no-changelog + - dependencies + authors: + - dependabot + categories: + - title: Fixed Bugs 🐛 + labels: + - bug + - breaking-change + - title: Exciting New Features 🎉 + labels: + - Enhancement + - title: Other Changes + labels: + - "*" diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml new file mode 100644 index 00000000..be303a25 --- /dev/null +++ b/.github/workflows/prepare-release.yml @@ -0,0 +1,70 @@ +name: Prepare Release +on: + workflow_dispatch: + inputs: + releaseType: + description: 'Release Type' + required: true + default: 'patch' + type: choice + options: + - major + - minor + - patch + + # push: + # tags: + # - '*' +jobs: + prepare-release: + runs-on: ubuntu-latest + steps: + - run: | + echo "Release type: $TYPE" + env: + TYPE: ${{ inputs.releaseType }} + - uses: actions/checkout@master + - name: Get Next Version + uses: reecetech/version-increment@2023.9.3 + id: version + with: + scheme: semver + increment: $TYPE + - name: Update theme TOML + run: sed -i '' "s/${{ github.ref_name }}/${{ steps.version.outputs.version }}/g" ./theme.toml + - name: Generate Changelog + uses: heinrichreimer/action-github-changelog-generator@v2.3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + user: mattstratton + project: castanet + future-release: ${{ steps.version.outputs.version }} + issues: "true" + issuesWoLabels: "false" + pullRequests: "true" + prWoLabels: "false" + compareLink: "false" + excludeLabels: 'duplicate,question,invalid,wontfix,do-not-merge,no-changelog' + - name: Commit changed files + uses: EndBug/add-and-commit@v9 + with: + add: '["theme.toml", "CHANGELOG.md"]' + author_name: "Matt Stratton" + author_email: "matt.stratton@gmail.com" + message: "Update theme to version ${{ steps.version.outputs.version }}" + tag: "${{ steps.version.outputs.version }} --force" + tag_push: '--force' + # - name: Create Zip File For Release + # uses: thedoctor0/zip-release@master + # with: + # command: "mkdir -p release" + # type: 'zip' + # filename: "release/${{ github.ref_name }}.zip" + # exclusions: '*.git* /*node_modules/* /*exampleSite/* /*.circleci/* /*bin/* /*gulp/* /*images/* /*release/* /*test/* /*utils/* .nvmrc CODE_OF_CONDUCT.md contributing.json CONTRIBUTING.md gulpfile.js lighthouserc.js matt-test.txt netlify.toml package.json package-lock.json' + # - name: Upload Release + # uses: ncipollo/release-action@v1 + # with: + # artifacts: "release/${{ github.ref_name }}.zip" + # generateReleaseNotes: true + # makeLatest: true + # token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..8e1aaa51 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,27 @@ +name: Release +on: + # workflow_run: + # workflows: [prepare-release] + # types: + # - completed + push: + tags: + - '*' +jobs: + release: + runs-on: ubuntu-latest + steps: + - name: Create Zip File For Release + uses: thedoctor0/zip-release@master + with: + command: "mkdir -p release" + type: 'zip' + filename: "release/${{ github.ref_name }}.zip" + exclusions: '*.git* /*node_modules/* /*exampleSite/* /*.circleci/* /*bin/* /*gulp/* /*images/* /*release/* /*test/* /*utils/* .nvmrc CODE_OF_CONDUCT.md contributing.json CONTRIBUTING.md gulpfile.js lighthouserc.js matt-test.txt netlify.toml package.json package-lock.json' + - name: Upload Release + uses: ncipollo/release-action@v1 + with: + artifacts: "release/${{ github.ref_name }}.zip" + generateReleaseNotes: true + makeLatest: true + token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file