Skip to content

Commit

Permalink
add automatic release of release-drafter (#1016)
Browse files Browse the repository at this point in the history
  • Loading branch information
jetersen committed Jan 16, 2022
1 parent 3bc1905 commit a0f1884
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 4 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/release.yml
@@ -0,0 +1,56 @@
name: Release
on:
push:
tags:
- v*.*.*
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: '16'
cache: yarn
registry-url: https://registry.npmjs.org

- name: yarn install
run: yarn install --frozen-lockfile

- name: yarn test
run: yarn test

- name: yarn publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPMJS_TOKEN }}
run: yarn publish --access public

- name: Deploy to Heroku
env:
HEROKU_API_TOKEN: ${{ secrets.HEROKU_API_TOKEN }}
HEROKU_APP_NAME: release-drafter
run: git push https://heroku:$HEROKU_API_TOKEN@git.heroku.com/$HEROKU_APP_NAME.git origin/master:master

- name: version
id: version
run: |
version=${{ github.event.release.tag_name }}
version=${version#v}
major=${version%%.*}
echo "::set-output name=version::${version}"
echo "::set-output name=major::${major}"
- uses: release-drafter/release-drafter@master
with:
version: '{{ steps.version.outputs.version }}'
publish: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: force update major tag
run: |
git tag v{{ steps.version.outputs.major }} ${{ github.event.release.tag_name }} -f
git push origin refs/tags/v{{ steps.version.outputs.major }} -f
4 changes: 2 additions & 2 deletions Dockerfile
@@ -1,8 +1,8 @@
FROM node:17.3.1-alpine@sha256:7ef8e673a9ea7b1dfaae292bf8faf549bb81ba60f68087454cef143698bdf2c4
ARG NODE_ENV=production
ENV NODE_ENV=${NODE_ENV}
LABEL "repository"="https://github.com/toolmantim/release-drafter"
LABEL "homepage"="https://github.com/toolmantim/release-drafter"
LABEL "repository"="https://github.com/release-drafter/release-drafter"
LABEL "homepage"="https://github.com/release-drafter/release-drafter"
LABEL "maintainer"="Tim Lucas"
LABEL "com.github.actions.name"="Release Drafter"
LABEL "com.github.actions.description"="Drafts your next release notes as pull requests are merged into master."
Expand Down
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -5,7 +5,7 @@
"description": "A GitHub app that draft releases based on pull-request labels",
"author": "Tim Lucas <t@toolmantim.com> (https://github.com/toolmantim)",
"license": "ISC",
"repository": "https://github.com/toolmantim/release-drafter",
"repository": "https://github.com/release-drafter/release-drafter",
"scripts": {
"build": "ncc build action.js --target es2021",
"dev": "nodemon --exec \"npm start\"",
Expand All @@ -16,7 +16,7 @@
"generate-fixtures": "node ./bin/generate-fixtures.js",
"lint": "eslint bin/*.js lib/*.js action.js index.js test/**/*.js",
"prettier": "prettier --write **/*.{js,md,json,yml,yaml}",
"postversion": "npm run test && git push && git push --tags && npm publish && npm run deploy && npm run open-releases",
"postversion": "npm run test && git push && git push --tags",
"open-releases": "open \"$(node -e 'console.log(`${require(\"./package.json\").repository}/releases`)')\"",
"deploy": "git push -f heroku \"$(node -e 'console.log(`v${require(\"./package.json\").version}`)')\":master",
"prepare": "husky install"
Expand Down

0 comments on commit a0f1884

Please sign in to comment.