-
Notifications
You must be signed in to change notification settings - Fork 25
58 lines (56 loc) · 1.98 KB
/
buildanddeploy.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
name: Build and Deploy
on:
push:
paths-ignore:
- '.github/workflow/lintandbuild.yml'
- '.gitignore'
- 'docs/**'
- '*.md'
branches:
- 'main'
jobs:
build:
runs-on: self-hosted
steps:
- uses: actions/checkout@v3
- name: Build Project
run: docker run --rm -v ${{ github.workspace }}:/tmp -w /tmp --entrypoint "/bin/sh" node:16-alpine -c "npm install && DISABLE_ESLINT_PLUGIN=true npm run build"
- name: Build Image
run: docker build -t local/flourish-2023:$GITHUB_RUN_NUMBER .
- name: Save Image
run: docker save --output flourish-2023.tar local/flourish-2023:$GITHUB_RUN_NUMBER
- name: Archive Image
uses: actions/upload-artifact@v3
with:
name: image
path: |
flourish-2023.tar
deploy:
runs-on: self-hosted
needs: build
steps:
- name: Download dist Artifacts
uses: actions/download-artifact@v3
with:
name: image
- name: Login to Docker
run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
- name: Load Docker Image
run: docker load --input flourish-2023.tar
- name: Tag Image Workflow Num
run: docker tag local/flourish-2023:$GITHUB_RUN_NUMBER ${{ secrets.DOCKER_USERNAME }}/flourish-2023:$GITHUB_RUN_NUMBER
- name: Tag Image Latest
run: docker tag local/flourish-2023:$GITHUB_RUN_NUMBER ${{ secrets.DOCKER_USERNAME }}/flourish-2023:latest
- name: Push Workflow Rev Image
run: docker push ${{ secrets.DOCKER_USERNAME }}/flourish-2023:$GITHUB_RUN_NUMBER
- name: Push Latest Image
run: docker push ${{ secrets.DOCKER_USERNAME }}/flourish-2023:latest
- name: Logout of Docker
run: docker logout
manage:
runs-on: self-hosted
needs: deploy
steps:
- uses: actions/checkout@v3
- name: Start the manage workflow
run: bin/manage_dispatch.sh ${{ secrets.MANAGE_DISPATCH_TOKEN }}