Skip to content

Commit 326a753

Browse files
Add template project with GitHub actions
1 parent f29bb46 commit 326a753

8 files changed

Lines changed: 3185 additions & 0 deletions

File tree

.github/workflows/CI.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: "Continuous integration"
2+
3+
on:
4+
push:
5+
branches:
6+
- dev
7+
- feature/*
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
- uses: actions/setup-node@v1
15+
- name: Test
16+
run: |
17+
yarn install
18+
yarn test
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: "Draft new release"
2+
3+
on:
4+
issue: [opened]
5+
6+
jobs:
7+
draft-new-release:
8+
runs-on: ubuntu-latest
9+
if: startsWith(github.event.issue.title, "Release version") # only run for issues with a specific title
10+
steps:
11+
- uses: actions/checkout@v2
12+
13+
- name: Extract version from issue title
14+
run: |
15+
TITLE=${{ github.event.issue.title }}
16+
VERSION=${TITLE#Release version }
17+
18+
echo "::set-env name=RELEASE_VERSION::$VERSION"
19+
20+
- name: Create release branch
21+
run: git checkout -b release/${{ env.RELEASE_VERSION }}
22+
23+
- name: Update changelog
24+
uses: thomaseizinger/keep-a-changelog-new-release@v1
25+
with:
26+
version: ${{ env.RELEASE_VERSION }}
27+
28+
- name: Initialize mandatory git config
29+
run: |
30+
git config user.name "GitHub actions"
31+
git config user.email noreply@github.com
32+
33+
# This step will differ depending on your project setup
34+
- name: Bump version in package.json
35+
run: yarn version --new-version ${{ env.RELEASE_VERSION }}
36+
37+
- name: Commit changelog and manifest files
38+
run: |
39+
git add CHANGELOG.md package.json
40+
git commit --message "Prepare release ${{ env.RELEASE_VERSION }}"
41+
42+
- name: Push new branch
43+
run: git push origin release/${{ env.RELEASE_VERSION }}
44+
45+
- name: Create pull request
46+
uses: thomaseizinger/create-pull-request@v1
47+
with:
48+
github-token: ${{ secrets.GITHUB_TOKEN }}
49+
branch: release/${{ env.RELEASE_VERSION }}
50+
base: master
51+
reviewers: ${{ github.event.issue.user.login }}
52+
body: |
53+
Resolves #${{ github.event.issue.number }}

.github/workflows/release.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: "Release new version"
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
- name: Extract version from branch (what about hot fixes?)
14+
- name: Make new release on GitHub

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
.idea

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased]
9+
10+
### Added
11+
12+
- Everything since the beginning!
13+
14+
[Unreleased]: https://github.com/thomaseizinger/github-action-gitflow-release-workflow/compare/https://github.com/thomaseizinger/github-action-gitflow-release-workflow...HEAD

index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
console.log("Hello world!");

index.test.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
it('works', function() {
2+
const sum = 2 + 2;
3+
4+
expect(sum).toEqual(4);
5+
});

0 commit comments

Comments
 (0)