1
+ # Build Node Workflow
2
+ #
3
+ # Based on Starter Workflow Here
4
+ # https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
5
+
6
+ # Workflow name
7
+ name : Build Node
8
+
9
+ # Run only on pushes and pull requests on main branch, as well as tags
10
+ # https://docs.github.com/en/actions/using-workflows/triggering-a-workflow
11
+ on :
12
+ push :
13
+ branches :
14
+ - main
15
+ tags :
16
+ - ' v*.*.*'
17
+ pull_request :
18
+ branches :
19
+ - main
20
+
21
+ # Define a single job named build
22
+ jobs :
23
+ build :
24
+ # Run job on Ubuntu runner
25
+ runs-on : ubuntu-latest
26
+
27
+ # Give all permissions
28
+ permissions : write-all
29
+
30
+ # Job Steps
31
+ steps :
32
+ # Step 1 - Checkout the Repository
33
+ # https://github.com/actions/checkout
34
+ - name : 1 - Checkout Repository
35
+ uses : actions/checkout@v3
36
+ with :
37
+ submodules : recursive
38
+
39
+ # Step 2 - Log In to GitHub Container Registry
40
+ # https://github.com/docker/login-action
41
+ - name : 2 - Login to GitHub Container Registry
42
+ uses : docker/login-action@v1
43
+ if : startsWith(github.ref, 'refs/tags/')
44
+ with :
45
+ registry : ghcr.io
46
+ username : ${{ github.repository_owner }}
47
+ password : ${{ secrets.GITHUB_TOKEN }}
48
+
49
+ # Step 3 - Build and Push Docker Image
50
+ # https://github.com/docker/build-push-action
51
+ - name : 3 - Build and Push Docker Image
52
+ uses : docker/build-push-action@v2
53
+ if : startsWith(github.ref, 'refs/tags/')
54
+ with :
55
+ context : ./js-docker/server
56
+ push : true
57
+ tags : |
58
+ ghcr.io/${{ github.repository_owner }}/js-docker:latest
59
+
60
+ # Step 4 - Make Release on GitHub
61
+ # https://github.com/softprops/action-gh-release
62
+ - name : 4 - Release
63
+ uses : softprops/action-gh-release@v1
64
+ if : startsWith(github.ref, 'refs/tags/')
65
+ with :
66
+ generate_release_notes : true
67
+
68
+ # Step 5 - Notify Discord for Deploy
69
+ # - name: Discord Deploy
70
+ # env:
71
+ # DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
72
+ # uses: Ilshidur/action-discord@master
73
+ # with:
74
+ # args: "js-docker Build Complete! Starting Deploy..."
75
+
76
+ # Step 6 - Deploy App
77
+ - name : 6 - Deploy Stage
78
+ id : request
79
+ uses : fjogeleit/http-request-action@master
80
+ with :
81
+ url : ' https://watchtower.dev.russfeld.me/v1/update'
82
+ method : ' GET'
83
+ bearerToken : ${{ secrets.DEPLOY_TOKEN }}
84
+ timeout : 600000
85
+
86
+ # Step 7 - Show Response
87
+ - name : Show Response
88
+ run : echo ${{ steps.request.outputs.response }}
0 commit comments