initial
This commit is contained in:
+22
@@ -0,0 +1,22 @@
|
||||
name: Run tests for all PRs
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- feature/github-actions
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
|
||||
- name: Checkout Code
|
||||
id: git-checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Install dependencies
|
||||
uses: pixl8/github-action-box-install@v2
|
||||
|
||||
- name: Run tests
|
||||
uses: pixl8/github-action-box-test@v3
|
||||
with:
|
||||
output_file: /tests/test-results.txt
|
||||
+86
@@ -0,0 +1,86 @@
|
||||
name: Release New Version
|
||||
|
||||
# Based on: https://github.blog/2021-12-16-5-automations-every-developer-should-be-running/
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: "Largest semver bump of new version (major / minor / patch)"
|
||||
required: true
|
||||
type: choice
|
||||
options:
|
||||
- patch
|
||||
- minor
|
||||
- major
|
||||
|
||||
jobs:
|
||||
bump-version:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
# Check out the content (source branch). Use a deploy key so that
|
||||
# when we push changes, it will trigger the release workflow
|
||||
# run that runs on: tag. (Using the GitHub token would
|
||||
# not run the workflow to prevent infinite recursion.)
|
||||
- name: Check out source
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
ssh-key: ${{ secrets.DEPLOY_KEY }}
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: "16"
|
||||
|
||||
- name: Setup Git
|
||||
run: |
|
||||
git config user.name 'release-bot'
|
||||
git config user.email 'adamtuttlecodes@gmail.com'
|
||||
|
||||
- name: bump version
|
||||
run: npm version ${{ github.event.inputs.version }}
|
||||
|
||||
- name: get-npm-version
|
||||
id: package-version
|
||||
uses: martinbeentjes/npm-get-version-action@master
|
||||
|
||||
- name: Update version in api.cfc
|
||||
run: |
|
||||
cat core/api.cfc | sed 's/local\._taffy\.version = \"[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\"/local._taffy.version = "${{ steps.package-version.outputs.current-version }}"/gi' > core/api.new.cfc
|
||||
rm -f core/api.cfc
|
||||
mv core/api.new.cfc core/api.cfc
|
||||
git add core/api.cfc
|
||||
git commit --amend --no-edit
|
||||
|
||||
- name: Cut a docs file for the new release
|
||||
run: |
|
||||
cat docs/@next.md | sed 's/@version@/${{ steps.package-version.outputs.current-version }}/gi' > docs/${{ steps.package-version.outputs.current-version }}.md
|
||||
git add docs/${{ steps.package-version.outputs.current-version }}.md
|
||||
cat docs/readme.md | sed 's/\<\!--new_docs_links_here--\>/\<\!--new_docs_links_here--\>\n\n- \[\v${{ steps.package-version.outputs.current-version }}]\(${{ steps.package-version.outputs.current-version }}.md\)/g' > docs/readme-next.md
|
||||
rm -f docs/readme.md
|
||||
mv docs/readme-next.md docs/readme.md
|
||||
git add docs/readme.md
|
||||
git commit --amend --no-edit
|
||||
|
||||
- name: Push latest version
|
||||
run: git push origin main --follow-tags
|
||||
|
||||
- name: Create Release Notes
|
||||
uses: actions/github-script@v4.0.2
|
||||
with:
|
||||
github-token: ${{secrets.GITHUB_TOKEN}}
|
||||
script: |
|
||||
await github.request(`POST /repos/${{ github.repository }}/releases`, {
|
||||
tag_name: "v${{ steps.package-version.outputs.current-version }}",
|
||||
generate_release_notes: true
|
||||
});
|
||||
|
||||
- name: Tweet-trigger-publish-release
|
||||
uses: mugi111/tweet-trigger-release@v1.1
|
||||
with:
|
||||
consumer_key: ${{ secrets.TWITTER_CONSUMER_API_KEY }}
|
||||
consumer_secret: ${{ secrets.TWITTER_CONSUMER_API_SECRET }}
|
||||
access_token_key: ${{ secrets.TWITTER_ACCESS_TOKEN }}
|
||||
access_token_secret: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}
|
||||
tweet_body: "🍬 Taffy Version ${{steps.package-version.outputs.current-version}} was just released! https://github.com/atuttle/Taffy/releases/tag/v${{ steps.package-version.outputs.current-version }}"
|
||||
@@ -0,0 +1,19 @@
|
||||
name: Require Semver Label
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, reopened, labeled, unlabeled, ready_for_review, synchronize]
|
||||
|
||||
jobs:
|
||||
check_pr_labels:
|
||||
runs-on: ubuntu-latest
|
||||
name: Verify that the PR has a valid label
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Verify PR label action
|
||||
uses: jesusvasquez333/verify-pr-label-action@v1.4.0
|
||||
with:
|
||||
github-token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
valid-labels: 'Semver-Major, Semver-Minor, Semver-Patch'
|
||||
pull-request-number: '${{ github.event.pull_request.number }}'
|
||||
Reference in New Issue
Block a user