Skip to content
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

Add an action that releases automatically when a change lands on the main branches #227

Merged
merged 23 commits into from
Dec 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
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
47 changes: 47 additions & 0 deletions .github/workflows/auto-git-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Summary:
# Automatically tag and release when changes land on the "main" branches.
#
# See https://github.com/PaulHatch/semantic-version https://github.com/PaulHatch/semantic-version/tree/v3.1.2
# See https://github.com/marvinpinto/action-automatic-releases https://github.com/marvinpinto/action-automatic-releases/tree/v1.1.0
# See https://github.com/rlespinasse/github-slug-action https://github.com/rlespinasse/github-slug-action/tree/3.x

name: 'Auto release'
on:
push:
branches:
# - main
# - master
- 'v2-*' # XXX NRN releases on v2 branches, but you'll likely want to release on either main or master

jobs:
tag-and-release:
runs-on: ubuntu-18.04
steps:
- name: Expose GitHub slug/short variables # See https://github.com/rlespinasse/github-slug-action#exposed-github-environment-variables
uses: rlespinasse/github-slug-action@v3.x
- uses: actions/checkout@v2
with:
fetch-depth: 0 # See https://github.com/PaulHatch/semantic-version#important-note-regarding-the-checkout-action
- uses: paulhatch/semantic-version@v3.1.2
id: next_semantic_version # Output: https://github.com/PaulHatch/semantic-version/blob/master/index.js#L63-L69
with: # See https://github.com/PaulHatch/semantic-version#usage
branch: ${{ env.GITHUB_REF_SLUG }} # Use current branch
tag_prefix: "v" # The prefix to use to identify tags
major_pattern: "(MAJOR)" # A string which, if present in a git commit, indicates that a change represents a major (breaking) change
minor_pattern: "(MINOR)" # Same as above except indicating a minor change
format: "${major}.${minor}.${patch}-${{ env.GITHUB_REF_SLUG }}.${increment}" # A string to determine the format of the version output
- run: |
echo "Branch name: ${{ env.GITHUB_REF_SLUG }}"
echo ${{join(steps.next_semantic_version.outputs.*, ' - ')}}
echo "Next version: ${{steps.next_semantic_version.outputs.version}}"
echo "Next version tag: ${{steps.next_semantic_version.outputs.version_tag}}"
- uses: marvinpinto/action-automatic-releases@10bdce64abdb4558a2ee6983192242be40d631d8 # Pin "latest" https://github.com/marvinpinto/action-automatic-releases/commit/10bdce64abdb4558a2ee6983192242be40d631d8 necessary to avoid "The `set-env` command is disabled."
with: # See https://github.com/marvinpinto/action-automatic-releases/tree/v1.1.0#supported-parameters
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: ${{steps.next_semantic_version.outputs.version_tag}}
prerelease: true
title: "Automatic release ${{steps.next_semantic_version.outputs.version_tag}} (`${{ env.GITHUB_REF_SLUG }}`)"
files: |
README.md
CHANGELOG.md
LICENSE
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"name": "next-right-now",
"version": "1.0.0",
"private": true,
"scripts": {
"start": "next dev --port 8888",
Expand Down