-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (52 loc) · 1.69 KB
/
deploy-to-prod.yml
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
name: Build and Deploy Binq Static Web
run-name: Building and Deploying
on:
pull_request:
branches:
- "dev"
- "master"
- "!feature-**/"
env:
NODE_VERSION: 20.10.0
ARTIFACT_RETENTION_DAYS: 90
TIMESTAMP: "(date +%Y-%m-%d-%H-%M-%S)"
RUN_NUM: "github.run_number"
jobs:
job_1_build:
name: Build and Upload Production Artifact
runs-on: ubuntu-latest
outputs:
artifact_name: "build_${{ env.TIMESTAMP }}"
steps:
- run: echo "Attempting to install required tools and build project"
- uses: actions/checkout@v4
- name: "Use Node.js ${{ env.NODE_VERSION }}"
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "npm"
- name: Install Dependencies and Build project
run: |
npm ci
npx tailwindcss build -i ./src/input.css -o ./src/output.css --minify
npm run build --f-present
- name: Store production artifacts
uses: actions/upload-artifact@v4
with:
name: "artifact_${{ env.RUN_NUM }}_${{ env.TIMESTAMP }}"
path: |
dist
!dist/**/*.md
retention-days: ${{ env.ARTIFACT_RETENTION_DAYS }}
- run: echo "🍏 Build and save artifact status is ${{ job.status }}."
job_2_deploy:
name: Attempt to Deploy Project
if: github.ref == 'refs/heads/master' && github.event.pull_request.merged
runs-on: ubuntu-latest
steps:
- name: Download Latest Artifact
uses: actions/download-artifact@v4
with:
name: "artifact_${{ needs.job_1_build.outputs.artifact_name }}"
- name: Deploy to Azure
run: echo "Deploy to Azure is a success!"