Skip to content

Add GH actions support #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 33 commits into from
Jun 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
d8b9e83
Add first CHANGELOG entry
fbenevides Jun 29, 2022
221ed1e
Add check release tag task
fbenevides Jun 29, 2022
c773dab
Bump beta version
fbenevides Jun 29, 2022
ac7fe99
Add create-release task (draft & prerelease)
fbenevides Jun 29, 2022
a4c508c
Fix prepare relase task
fbenevides Jun 29, 2022
eba6ef8
Identify this release as prerelease but not a draft
fbenevides Jun 29, 2022
cca8021
Start using Pusher release standard
fbenevides Jun 29, 2022
87e1ab3
Test bumping version
fbenevides Jun 29, 2022
9035a86
Fix set-release-type task
fbenevides Jun 29, 2022
3ccd97c
Fix release type
fbenevides Jun 29, 2022
0f3e196
Fix npm step
fbenevides Jun 29, 2022
516b804
Fix RELEASE var
fbenevides Jun 29, 2022
84267f2
Fix Beta release variable
fbenevides Jun 29, 2022
c449c5f
Test action by pushing to this branch
fbenevides Jun 29, 2022
d8b6636
Fix checkout task
fbenevides Jun 29, 2022
fcaf624
Just test
fbenevides Jun 29, 2022
f0f768d
Fix testing
fbenevides Jun 29, 2022
7431289
Testing release type
fbenevides Jun 29, 2022
f9c905d
Fix beta release name
fbenevides Jun 29, 2022
966e19b
Fix PR branch
fbenevides Jun 29, 2022
299d9d0
First version of CI
fbenevides Jun 29, 2022
35598c3
Add build step to release
fbenevides Jun 29, 2022
1c9fcf7
Declare yarn dependencies
fbenevides Jun 29, 2022
104381c
Add pre release step
fbenevides Jun 29, 2022
39cb5e7
Add publish task (with dry-run=true)
fbenevides Jun 29, 2022
22140e7
Enable continue-on-error
fbenevides Jun 29, 2022
1a05dd1
Testing publish
fbenevides Jun 29, 2022
ccac84c
Run CI
fbenevides Jun 29, 2022
4780e92
Using NPM instead of Yarn
fbenevides Jun 29, 2022
3a4a647
Remove whitespace
fbenevides Jun 29, 2022
b205157
Run CD
fbenevides Jun 29, 2022
7e2757a
Run GHA
fbenevides Jun 29, 2022
e4f86ba
First version
fbenevides Jun 29, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 90 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
on:
push:
branches: [ master ]

jobs:
check-release-tag:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Prepare tag
id: prepare_tag
continue-on-error: true
run: |
export TAG=v$(jq -r '.version' package.json)
echo "TAG=$TAG" >> $GITHUB_ENV
export CHECK_TAG=$(git tag | grep $TAG)
if [[ $CHECK_TAG ]]; then
echo "Skipping because release tag already exists"
exit 1
fi
- name: Output
id: release_output
if: ${{ steps.prepare_tag.outcome == 'success' }}
run: |
echo "::set-output name=tag::${{ env.TAG }}"
outputs:
tag: ${{ steps.release_output.outputs.tag }}

build:
runs-on: ubuntu-latest
needs: check-release-tag
if: ${{ needs.check-release-tag.outputs.tag }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16.x
- run: npm install

publish-npm:
runs-on: ubuntu-latest
needs: build
if: ${{ needs.check-release-tag.outputs.tag }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16.x
registry-url: https://registry.npmjs.org/
scope: '@pusher'
- run: npm install
- run: npm publish --dry-run --verbose --access public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}

create-github-release:
runs-on: ubuntu-latest
needs: publish-npm
if: ${{ needs.check-release-tag.outputs.tag }}
steps:
- uses: actions/checkout@v2
- name: Prepare tag
run: |
export TAG=v$(jq -r '.version' package.json)
echo "PRE_RELEASE=false" >> $GITHUB_ENV
echo "TAG=$TAG" >> $GITHUB_ENV
- name: Check pre release
if: contains(env.TAG, 'beta')
run: echo "PRE_RELEASE=true" >> $GITHUB_ENV
- name: Setup git
run: |
git config user.email "[email protected]"
git config user.name "Pusher CI"
- name: Prepare description
run: |
csplit -s CHANGELOG.md "/##/" {0}
cat xx01 > CHANGELOG.tmp
- name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.TAG }}
release_name: ${{ env.TAG }}
body_path: CHANGELOG.tmp
draft: false
prerelease: ${{ env.PRE_RELEASE }}
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Changelog

## 0.0.1-beta1

* [ADDED] First beta release 🥳
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pusher-websocket-react-native",
"version": "0.1.0",
"version": "0.0.1-beta1",
"description": "Pusher Channels Client for React Native",
"main": "lib/commonjs/index",
"module": "lib/module/index",
Expand Down