5
0
Fork 0
mirror of https://github.com/cycjimmy/semantic-release-action.git synced 2025-11-07 10:46:56 +00:00
semantic-release-action/.github/workflows/release.yml
cycjimmy 12a1a39975 feat(outputs): Add outputs related to new release version
Add outputs related to new release version
- `new-release-version`: Version of the new release
- `new-release-major-version`: Major version of the new release
- `new-release-minor-version`: Minor version of the new release
- `new-release-patch-version`: Patch version of the new release
2019-10-21 09:46:25 +08:00

68 lines
2.1 KiB
YAML

name: Release
on:
pull_request:
branches:
- master
push:
branches:
- master
jobs:
release:
name: release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Setup Node.js with GitHub Package Registry
uses: actions/setup-node@v1
with:
node-version: 12
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
registry-url: 'https://npm.pkg.github.com'
scope: 'cycjimmy'
always-auth: true
- name: Setup Node.js with Npm Package Registry
uses: actions/setup-node@v1
with:
node-version: 12
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
registry-url: 'https://registry.npmjs.org'
always-auth: true
- name: Set .npmrc
env:
CI: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
echo "//npm.pkg.github.com/:_authToken=$GITHUB_TOKEN" > /home/runner/work/_temp/.npmrc
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> /home/runner/work/_temp/.npmrc
- name: Semantic Release
uses: cycjimmy/semantic-release-action@master
id: semantic
with:
branch: master
extra_plugins: |
@semantic-release/git
@semantic-release/changelog
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish To GitHub Package Registry
if: steps.semantic.outputs.new-release-published == 'true'
run: npm publish --@cycjimmy:registry='https://npm.pkg.github.com'
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Push updates to branch for major version
if: steps.semantic.outputs.new-release-published == 'true'
run: "git push https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git HEAD:refs/heads/${steps.semantic.outputs.new-release-major-version}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}