diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 0000000..bdac0fa --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,38 @@ +name-template: 'v$RESOLVED_VERSION 🌈' +tag-template: 'v$RESOLVED_VERSION' +categories: + - title: '🚀 Features' + labels: + - 'feature' + - 'enhancement' + - title: '🐛 Bug Fixes' + labels: + - 'fix' + - 'bugfix' + - 'bug' + - title: '🧰 Maintenance' + labels: + - 'chore' + - 'doc' + - 'documentation' + - 'modifications' + - 'maintenance' + - 'refactoring' +change-template: '- $TITLE @$AUTHOR (#$NUMBER)' +exclude-labels: + - 'skip-changelog' +version-resolver: + major: + labels: + - 'major' + minor: + labels: + - 'minor' + patch: + labels: + - 'patch' + default: patch +template: | + ## Changes + + $CHANGES diff --git a/.github/workflows/build-and-tag.yml b/.github/workflows/build-and-tag.yml new file mode 100644 index 0000000..31c4e92 --- /dev/null +++ b/.github/workflows/build-and-tag.yml @@ -0,0 +1,53 @@ +name: Build and tag + +on: + push: + branches: + - main # Default release branch + tags: + - "!*" + +jobs: + build: + name: build + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 1 + - name: Setup Node + uses: actions/setup-node@v2 + with: + node-version: '14.x' + - name: install dependencies + run: npm install + - name: lint + run: npm run lint + - name: build + env: + NODE_ENV: production + run: npm run build + + - name: get version + id: get_package_version + run: echo "::set-output name=version::$(node -p -e "require('./package.json').version")" + - name: set version + run: echo "PACKAGE_VERSION=${{ steps.get_package_version.outputs.version }}" >> $GITHUB_ENV + + - name: package-version-to-git-tag + uses: pkgdeps/git-tag-action@v2 + with: + github_token: ${{ secrets.GH_TOKEN }} + github_repo: ${{ github.repository }} + version: ${{ env.PACKAGE_VERSION }} + git_commit_sha: ${{ github.sha }} + git_tag_prefix: "v" + - name: Release Drafter + id: release_drafter + uses: release-drafter/release-drafter@v5 + with: + config-name: release-drafter.yml + version: ${{ env.PACKAGE_VERSION }} + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} diff --git a/.github/workflows/publish-gh-page.yml b/.github/workflows/publish-gh-page.yml new file mode 100644 index 0000000..6913396 --- /dev/null +++ b/.github/workflows/publish-gh-page.yml @@ -0,0 +1,42 @@ +name: publish gh-pages + +on: + push: + tags: + - 'v*' + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 1 # Fetch all history for .GitInfo and .Lastmod + + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + node-version: '14' + - name: Install dependencies + run: npm install + + - name: Build + run: npm run build + env: + NODE_ENV: production + + - name: Prepare tag + id: prepare_tag + if: startsWith(github.ref, 'refs/tags/') + run: | + TAG_NAME="${GITHUB_REF##refs/tags/}" + echo "::set-output name=tag_name::${TAG_NAME}" + echo "::set-output name=deploy_tag_name::deploy-${TAG_NAME}" + - name: Deploy + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GH_TOKEN }} + publish_branch: gh-pages + publish_dir: ./out + tag_name: ${{ steps.prepare_tag.outputs.deploy_tag_name }} + tag_message: 'Deployment ${{ steps.prepare_tag.outputs.tag_name }}' \ No newline at end of file