-
Notifications
You must be signed in to change notification settings - Fork 1
105 lines (91 loc) · 3.53 KB
/
Copy pathmain.yml
File metadata and controls
105 lines (91 loc) · 3.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
paths-ignore: [ "**/*.md" ]
pull_request:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install node
uses: actions/setup-node@v2.1.5
with:
node-version: '14.*'
- name: Set version format
id: setformat
run: |
if [[ $GITHUB_REF == refs/tags/* ]]; then
echo '::set-output name=VERSION_FORMAT::${major}.${minor}.${patch}'
else
echo '::set-output name=VERSION_FORMAT::${major}.${minor}.${patch}-alpha.${increment}'
fi
- name: Git semantic version
id: version
uses: PaulHatch/semantic-version@v3.1.2
with:
tag_prefix: ''
format: ${{steps.setformat.outputs.VERSION_FORMAT}}
branch: main
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Run build
run: |
npm install
npm run build -- -- -v ${{ steps.version.outputs.version }}
npm run test
env:
NODE_AUTH_TOKEN: ${{ secrets.STEP_PACKAGES_SECRET }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_CLIENT_PASSWORD: ${{ secrets.AZURE_CLIENT_PASSWORD }}
- name: Create steps package
run: |
cd output/staged
zip ../../steps-package-helloworld.${{ steps.version.outputs.version }}.zip \
hello-world-upload.${{ steps.version.outputs.version }}.zip \
hello-world-target.${{ steps.version.outputs.version }}.zip
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.version.outputs.version }}
release_name: Release ${{ steps.version.outputs.version }}
draft: false
prerelease: false
- name: Upload steps artifacts
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: steps-package-helloworld.${{ steps.version.outputs.version }}.zip
asset_name: steps-package-helloworld.${{ steps.version.outputs.version }}.zip
asset_content_type: application/zip