|
1 | | -# TODO get inspiration by https://github.com/formium/formik/blob/master/.github/workflows/release.yml |
2 | | -# https://www.christopherbiscardi.com/post/shipping-multipackage-repos-with-github-actions-changesets-and-lerna |
3 | | - |
4 | 1 | name: release |
5 | 2 | on: |
6 | | - pull_request: |
| 3 | + push: |
7 | 4 | branches: |
8 | 5 | - master |
9 | | - types: [closed] |
10 | 6 |
|
11 | 7 | jobs: |
12 | | - publish: |
13 | | - name: Publish |
| 8 | + release: |
| 9 | + name: Release |
14 | 10 | runs-on: ubuntu-latest |
15 | 11 | steps: |
16 | 12 |
|
17 | 13 | # Checkout Project |
18 | 14 | - name: 📚 Checkout |
19 | 15 | uses: actions/checkout@v2 |
20 | 16 |
|
21 | | - # Setup NodeJS |
| 17 | + # Setup NodeJS |
22 | 18 | - name: 🟢 Setup Node ${{ matrix.node_version }} |
23 | 19 | uses: actions/setup-node@v1 |
24 | | - with: |
25 | | - node-version: 12 |
| 20 | + with: |
| 21 | + node-version: 12 |
26 | 22 |
|
27 | 23 | # Install Dependencies |
28 | | - - name: ⏳ Install |
29 | | - run: yarn install |
| 24 | + - name: ⏳ Install |
| 25 | + run: yarn install |
| 26 | + |
| 27 | + - name: 🚀 Create Release Pull Request |
| 28 | + uses: changesets/action@master |
| 29 | + env: |
| 30 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 31 | + |
| 32 | +# -- OLD -- |
| 33 | +# |
| 34 | +# name: release |
| 35 | +# on: |
| 36 | +# pull_request: |
| 37 | +# branches: |
| 38 | +# - master |
| 39 | +# |
| 40 | +# jobs: |
| 41 | +# publish: |
| 42 | +# name: Publish |
| 43 | +# runs-on: ubuntu-latest |
| 44 | +# steps: |
| 45 | + |
| 46 | +# # Checkout Project |
| 47 | +# - name: 📚 Checkout |
| 48 | +# uses: actions/checkout@v2 |
| 49 | + |
| 50 | +# # Setup NodeJS |
| 51 | +# - name: 🟢 Setup Node ${{ matrix.node_version }} |
| 52 | +# uses: actions/setup-node@v1 |
| 53 | +# with: |
| 54 | +# node-version: 12 |
| 55 | + |
| 56 | +# # Install Dependencies |
| 57 | +# - name: ⏳ Install |
| 58 | +# run: yarn install |
30 | 59 |
|
31 | | - # Configure Git User so that it can perform Git Actions like commits |
32 | | - - name: 👷 Configure Git User |
33 | | - run: | |
34 | | - git config --global user.name 'bennodev19' |
35 | | - git config --global user.email 'bennodev19@users.noreply.github.com' |
36 | | - env: |
37 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 60 | +# # Configure Git User so that it can perform Git Actions like commits |
| 61 | +# - name: 👷 Configure Git User |
| 62 | +# run: | |
| 63 | +# git config --global user.name 'bennodev19' |
| 64 | +# git config --global user.email 'bennodev19@users.noreply.github.com' |
| 65 | +# env: |
| 66 | +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
38 | 67 |
|
39 | | - # Define ${CURRENT_VERSION} |
40 | | - - name: 🔑 Set Current Version |
41 | | - shell: bash -ex {0} |
42 | | - run: | |
43 | | - CURRENT_VERSION=$(node -p 'require("./lerna.json").version') |
44 | | - echo "CURRENT_VERSION=${CURRENT_VERSION}" >> $GITHUB_ENV |
| 68 | +# # Define ${CURRENT_VERSION} |
| 69 | +# - name: 🔑 Set Current Version |
| 70 | +# shell: bash -ex {0} |
| 71 | +# run: | |
| 72 | +# CURRENT_VERSION=$(node -p 'require("./lerna.json").version') |
| 73 | +# echo "CURRENT_VERSION=${CURRENT_VERSION}" >> $GITHUB_ENV |
45 | 74 |
|
46 | | - # Check if Tag with the CURRENT_VERSION already exists |
47 | | - - name: Tag Check |
48 | | - id: tag-check |
49 | | - shell: bash -ex {0} |
50 | | - run: | |
51 | | - GET_API_URL="https://api.github.com/repos/${GITHUB_REPOSITORY}/git/ref/tags/v${CURRENT_VERSION}" |
52 | | - http_status_code=$(curl -LI $GET_API_URL -o /dev/null -w '%{http_code}\n' -s \ |
53 | | - -H "Authorization: token ${GITHUB_TOKEN}") |
54 | | - if [ "$http_status_code" -ne "404" ] ; then |
55 | | - echo "::set-output name=exists_tag::true" |
56 | | - else |
57 | | - echo "::set-output name=exists_tag::false" |
58 | | - fi |
59 | | - env: |
60 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 75 | +# # Check if Tag with the CURRENT_VERSION already exists |
| 76 | +# - name: Tag Check |
| 77 | +# id: tag-check |
| 78 | +# shell: bash -ex {0} |
| 79 | +# run: | |
| 80 | +# GET_API_URL="https://api.github.com/repos/${GITHUB_REPOSITORY}/git/ref/tags/v${CURRENT_VERSION}" |
| 81 | +# http_status_code=$(curl -LI $GET_API_URL -o /dev/null -w '%{http_code}\n' -s \ |
| 82 | +# -H "Authorization: token ${GITHUB_TOKEN}") |
| 83 | +# if [ "$http_status_code" -ne "404" ] ; then |
| 84 | +# echo "::set-output name=exists_tag::true" |
| 85 | +# else |
| 86 | +# echo "::set-output name=exists_tag::false" |
| 87 | +# fi |
| 88 | +# env: |
| 89 | +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
61 | 90 |
|
62 | | - # Create Git Tag if Tag doesn't already exists |
63 | | - - name: 🏷 Create Git Tag |
64 | | - if: steps.tag-check.outputs.exists_tag == 'false' |
65 | | - uses: azu/action-package-version-to-git-tag@v1 |
66 | | - with: |
67 | | - version: ${{ env.CURRENT_VERSION }} |
68 | | - github_token: ${{ secrets.GITHUB_TOKEN }} |
69 | | - github_repo: ${{ github.repository }} |
70 | | - git_commit_sha: ${{ github.sha }} |
71 | | - git_tag_prefix: "v" |
| 91 | +# # Create Git Tag if Tag doesn't already exists |
| 92 | +# - name: 🏷 Create Git Tag |
| 93 | +# if: steps.tag-check.outputs.exists_tag == 'false' |
| 94 | +# uses: azu/action-package-version-to-git-tag@v1 |
| 95 | +# with: |
| 96 | +# version: ${{ env.CURRENT_VERSION }} |
| 97 | +# github_token: ${{ secrets.GITHUB_TOKEN }} |
| 98 | +# github_repo: ${{ github.repository }} |
| 99 | +# git_commit_sha: ${{ github.sha }} |
| 100 | +# git_tag_prefix: "v" |
72 | 101 |
|
73 | | - # Create Release |
74 | | - - name: 📝 Create Release |
75 | | - id: create-release |
76 | | - if: steps.tag-check.outputs.exists_tag == 'false' && github.event.pull_request.merged == true |
77 | | - uses: actions/create-release@v1 |
78 | | - env: |
79 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
80 | | - with: |
81 | | - tag_name: v${{ env.CURRENT_VERSION }} |
82 | | - # Copy Pull Request's tile and body to Release Note |
83 | | - release_name: ${{ github.event.pull_request.title }} |
84 | | - body: | |
85 | | - ${{ github.event.pull_request.body }} |
86 | | - draft: false |
87 | | - prerelease: false |
| 102 | +# # Create Release |
| 103 | +# - name: 📝 Create Release |
| 104 | +# id: create-release |
| 105 | +# if: steps.tag-check.outputs.exists_tag == 'false' && github.event.pull_request.merged == true |
| 106 | +# uses: actions/create-release@v1 |
| 107 | +# env: |
| 108 | +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 109 | +# with: |
| 110 | +# tag_name: v${{ env.CURRENT_VERSION }} |
| 111 | +# # Copy Pull Request's tile and body to Release Note |
| 112 | +# release_name: ${{ github.event.pull_request.title }} |
| 113 | +# body: | |
| 114 | +# ${{ github.event.pull_request.body }} |
| 115 | +# draft: false |
| 116 | +# prerelease: false |
88 | 117 |
|
89 | | - # Publish |
90 | | - - name: 🚀 Publish |
91 | | - if: steps.tag-check.outputs.exists_tag == 'false' |
92 | | - run: | |
93 | | - yarn lerna publish from-package --yes |
94 | | - env: |
95 | | - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
96 | | - NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} |
97 | | - - uses: actions/github-script@0.8.0 |
98 | | - with: |
99 | | - github-token: ${{secrets.GITHUB_TOKEN}} |
100 | | - script: | |
101 | | - github.issues.createComment({ |
102 | | - issue_number: context.issue.number, |
103 | | - owner: context.repo.owner, |
104 | | - repo: context.repo.repo, |
105 | | - body: 'https://github.com/${{ github.repository }}/releases/tag/v${{ env.CURRENT_VERSION }} is released 🎉' |
106 | | - }) |
| 118 | +# # Publish |
| 119 | +# - name: 🚀 Publish |
| 120 | +# if: steps.tag-check.outputs.exists_tag == 'false' |
| 121 | +# run: | |
| 122 | +# yarn lerna publish from-package --yes |
| 123 | +# env: |
| 124 | +# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 125 | +# NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} |
| 126 | +# - uses: actions/github-script@0.8.0 |
| 127 | +# with: |
| 128 | +# github-token: ${{secrets.GITHUB_TOKEN}} |
| 129 | +# script: | |
| 130 | +# github.issues.createComment({ |
| 131 | +# issue_number: context.issue.number, |
| 132 | +# owner: context.repo.owner, |
| 133 | +# repo: context.repo.repo, |
| 134 | +# body: 'https://github.com/${{ github.repository }}/releases/tag/v${{ env.CURRENT_VERSION }} is released 🎉' |
| 135 | +# }) |
0 commit comments