-
Notifications
You must be signed in to change notification settings - Fork 117
86 lines (73 loc) · 3.37 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
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 }}"