Skip to content
This repository has been archived by the owner on Oct 22, 2021. It is now read-only.

Commit

Permalink
Fix release script
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoColomb committed Mar 18, 2020
1 parent 32c4747 commit 6e077a2
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,46 +15,51 @@ jobs:

steps:
- uses: actions/checkout@v1
- uses: actions/cache@v1
with:
path: last_release
key: request_release
- name: Release requested
- uses: actions/[email protected]
id: request_release
run: |
if [ ! -f "last_release" ] || [ "$(cat last_release)" != "$GITHUB_SHA" ]; then
echo "::set-output name=request_release::1"
fi
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
result-encoding: string
script: |
const latest = await github.repos.getLatestRelease({
owner: context.repo.owner,
repo: context.repo.repo,
});
const commits = await github.repos.listCommits({
owner: context.repo.owner,
repo: context.repo.repo,
since: latest.data.published_at
});
return commits.data.length > 0
- name: Use Node.js ${{ matrix.node-version }}
if: contains(steps.request_release.outputs.request_release, '1')
if: contains(steps.request_release.outputs.result, 'true')
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: npm install, build, and test
if: contains(steps.request_release.outputs.request_release, '1')
if: contains(steps.request_release.outputs.result, 'true')
run: |
npm install
npm run build --if-present
npm test
env:
CI: true
- name: Generate release name
if: contains(steps.request_release.outputs.request_release, '1')
if: contains(steps.request_release.outputs.result, 'true')
id: release_name
run: |
echo "::set-output name=version::$(npx daily-version)"
- name: Create Release
if: contains(steps.request_release.outputs.request_release, '1')
if: contains(steps.request_release.outputs.result, 'true')
id: create_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.release_name.outputs.version }}
release_name: Release ${{ steps.release_name.outputs.version }}
- run: echo $GITHUB_SHA > last_release
- name: Publish
if: contains(steps.request_release.outputs.request_release, '1')
if: contains(steps.request_release.outputs.result, 'true')
run: npm run release
env:
VER: ${{ steps.release_name.outputs.version }}
Expand Down

0 comments on commit 6e077a2

Please sign in to comment.