Merge pull request #3521 from thelounge/github-action-release

Create release github action workflow
This commit is contained in:
Pavel Djundik 2019-11-26 22:45:19 +02:00 committed by GitHub
commit bbbaf128bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 48 additions and 65 deletions

48
.github/workflows/release.yml vendored Normal file
View File

@ -0,0 +1,48 @@
name: Release
on:
push:
tags: v*
jobs:
release:
name: Release workflow
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Setup Node.js
uses: actions/setup-node@v1
with:
registry-url: "https://registry.npmjs.org/"
- name: Install
run: yarn --frozen-lockfile --non-interactive
- name: Build
run: yarn build
env:
NODE_ENV: production
- name: Test
run: yarn test
- name: Publish latest
if: "!contains(github.ref, '-')"
run: npm publish --tag latest
env:
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
- name: Publish next
if: contains(github.ref, '-')
run: npm publish --tag next
env:
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
- name: Remove next tag
if: "!contains(github.ref, '-')"
run: npm dist-tag rm thelounge next || true
env:
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}

View File

@ -1,62 +0,0 @@
language: node_js
# https://github.com/nodejs/Release
# Specify current LTS version here, which is used for publishing to npm
node_js:
- 10 # EOL: April 2021
os:
- linux
# https://github.com/nodejs/Release
matrix:
fast_finish: true
include:
# Version used to deploy to npm registry
- name: "Production build"
env: BUILD_ENV=production
# Next node version
- node_js: 12 # EOL: April 2022
cache: yarn
before_script:
- NODE_ENV=$BUILD_ENV yarn build
install:
- yarn --frozen-lockfile --non-interactive --network-timeout 300000
notifications:
email:
on_success: never
on_failure: always
# Identifies `a.b.c-xxx.n` tags as pre-releases, and `a.b.c` as stable releases
before_deploy: |
function npm_dist_tag() {
if [[ "$TRAVIS_TAG" = *"-"* ]]; then
echo "next"
else
echo "latest"
fi
}
deploy:
skip_cleanup: true # prevent git stash --all which nukes node_modules folder
provider: npm
tag: $(np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zRq/oCtEk27DWUc/NHJiv/+7uKXSAeSZ0OqDCNxLXfre0nFtzcrXZ5aV4aspjbKrbYZj10gef4q5/OzTFJOxRifPDjvpxnACwGsgZaqei/grRNHkVkHci1IRn56Vj7oKuFJemmckJXi/QuozXf72oYYfi4LUamdfNu/5i5tKV/cj4TFsB+sOt/by9qxPPo/YXkGKTrdoqSshLX0tKyf69zS8Bmp/mb768a1vrxZRco0EajP4YzzoNMjnWpgjFikTNOJ2DzuySdSjVcU2d0OLge7OBtui9yaYA68ETNaA0uhQVxmBOb/Ujt9OGAqrhskU=
on:
condition: "$BUILD_ENV = production"
tags: true
repo: thelounge/thelounge
# If the current release is a stable release, remove potential pre-release tag
after_deploy: |
if [ "$(npm_dist_tag)" == "latest" ]; then
npm dist-tag rm thelounge next || true
fi

View File

@ -25,9 +25,6 @@
<a href="https://yarn.pm/thelounge"><img
alt="npm version"
src="https://img.shields.io/npm/v/thelounge.svg?colorA=333a41&maxAge=3600"></a>
<a href="https://travis-ci.com/thelounge/thelounge"><img
alt="Travis CI Build Status"
src="https://img.shields.io/travis/com/thelounge/thelounge/master.svg?colorA=333a41&logo=travis-ci&logoColor=959da5&label=Build&maxAge=60"></a>
<a href="https://github.com/thelounge/thelounge/actions"><img
alt="Build Status"
src="https://github.com/thelounge/thelounge/workflows/Build/badge.svg"></a>