Skip to content

Commit

Permalink
use version and zip file from build job
Browse files Browse the repository at this point in the history
  • Loading branch information
angelo-v committed Nov 2, 2021
1 parent b5ca194 commit faf996e
Showing 1 changed file with 16 additions and 23 deletions.
39 changes: 16 additions & 23 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,19 @@ jobs:
strategy:
matrix:
node-version: [ 16.x ]
outputs:
version: ${{ steps.extract_version.outputs.version }}
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- run: npm ci
- run: npm run lint
- run: npm test
- run: npm run build
- name: Save build
uses: actions/upload-artifact@v2
with:
name: build
path: |
build
package.json
retention-days: 1

pre-release:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v2
with:
name: build

- name: Extract version
id: extract_version
Expand All @@ -57,33 +44,39 @@ jobs:
path: build/webclip-${{ steps.extract_version.outputs.version }}.zip
retention-days: 30

pre-release:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v2
with:
name: zip

- name: Create pre-release
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.extract_version.outputs.version }}-dev
tag: ${{ needs.build.outputs.version }}-dev
commit: ${{ github.sha }}
prerelease: true
allowUpdates: true
artifacts: "build/*.zip"
token: ${{ secrets.GITHUB_TOKEN }}

release:
needs: pre-release
needs:
- build
- pre-release
environment: prod
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v2
with:
name: zip

- name: Extract version
id: extract_version
uses: Saionaro/extract-package-version@v1.0.6

- name: Create draft release
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.extract_version.outputs.version }}
tag: ${{ needs.build.outputs.version }}
commit: ${{ github.sha }}
allowUpdates: false
artifacts: "build/*.zip"
Expand Down

0 comments on commit faf996e

Please sign in to comment.