Skip to content

Commit bf4d980

Browse files
committed
Add deploy from release
1 parent e975f7b commit bf4d980

File tree

1 file changed

+76
-73
lines changed

1 file changed

+76
-73
lines changed

.github/workflows/nextjs.yml

Lines changed: 76 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ on:
77
push:
88
branches: ['main', 'production']
99

10+
release:
11+
types: [published]
12+
1013
# Allows you to run this workflow manually from the Actions tab
1114
workflow_dispatch:
1215

@@ -78,56 +81,56 @@ jobs:
7881
./public
7982
Dockerfile
8083
81-
# build-static:
82-
# runs-on: ubuntu-latest
83-
# environment:
84-
# name: github-pages
85-
# url: https://wsaf.org.uk
86-
#
87-
# steps:
88-
# - name: Checkout branch
89-
# uses: actions/checkout@v4
90-
#
91-
# - name: Setup Node
92-
# uses: actions/setup-node@v4
93-
# with:
94-
# node-version: '20'
95-
# cache: 'npm'
96-
#
97-
# - name: Setup Pages
98-
# uses: actions/configure-pages@v5
99-
# with:
100-
# # Automatically inject basePath in your Next.js configuration file and disable
101-
# # server side image optimization (https://nextjs.org/docs/api-reference/next/image#unoptimized).
102-
# #
103-
# # You may remove this line if you want to manage the configuration yourself.
104-
# static_site_generator: next
105-
#
106-
# - name: Restore cache
107-
# uses: actions/cache@v4
108-
# with:
109-
# path: .next/cache
110-
# # Generate a new cache whenever packages or source files change.
111-
# key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
112-
# # If source files changed but packages didn't, rebuild from a prior cache.
113-
# restore-keys: |
114-
# ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
115-
#
116-
# - name: Install dependencies
117-
# run: npm ci
118-
#
119-
# - name: Build website
120-
# run: npm run build
121-
# env:
122-
# NEXTJS_OUTPUT: 'export'
123-
# BASE_URL: ${{ vars.BASE_URL }}
124-
# NEXT_PUBLIC_GOOGLE_ANALYTICS_ID: ${{ vars.NEXT_PUBLIC_GOOGLE_ANALYTICS_ID }}
125-
# WSAF_ASSETS_BASE_URL: ${{ vars.WSAF_ASSETS_BASE_URL }}
126-
#
127-
# - name: Upload artifact
128-
# uses: actions/upload-pages-artifact@v3
129-
# with:
130-
# path: ./out
84+
# build-static:
85+
# runs-on: ubuntu-latest
86+
# environment:
87+
# name: github-pages
88+
# url: https://wsaf.org.uk
89+
#
90+
# steps:
91+
# - name: Checkout branch
92+
# uses: actions/checkout@v4
93+
#
94+
# - name: Setup Node
95+
# uses: actions/setup-node@v4
96+
# with:
97+
# node-version: '20'
98+
# cache: 'npm'
99+
#
100+
# - name: Setup Pages
101+
# uses: actions/configure-pages@v5
102+
# with:
103+
# # Automatically inject basePath in your Next.js configuration file and disable
104+
# # server side image optimization (https://nextjs.org/docs/api-reference/next/image#unoptimized).
105+
# #
106+
# # You may remove this line if you want to manage the configuration yourself.
107+
# static_site_generator: next
108+
#
109+
# - name: Restore cache
110+
# uses: actions/cache@v4
111+
# with:
112+
# path: .next/cache
113+
# # Generate a new cache whenever packages or source files change.
114+
# key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
115+
# # If source files changed but packages didn't, rebuild from a prior cache.
116+
# restore-keys: |
117+
# ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
118+
#
119+
# - name: Install dependencies
120+
# run: npm ci
121+
#
122+
# - name: Build website
123+
# run: npm run build
124+
# env:
125+
# NEXTJS_OUTPUT: 'export'
126+
# BASE_URL: ${{ vars.BASE_URL }}
127+
# NEXT_PUBLIC_GOOGLE_ANALYTICS_ID: ${{ vars.NEXT_PUBLIC_GOOGLE_ANALYTICS_ID }}
128+
# WSAF_ASSETS_BASE_URL: ${{ vars.WSAF_ASSETS_BASE_URL }}
129+
#
130+
# - name: Upload artifact
131+
# uses: actions/upload-pages-artifact@v3
132+
# with:
133+
# path: ./out
131134

132135
release-container:
133136
name: 'Package and Release Container'
@@ -168,16 +171,16 @@ jobs:
168171
labels: ${{ steps.meta.outputs.labels }}
169172

170173
# Deployment job
171-
# deploy-static:
172-
# environment:
173-
# name: github-pages
174-
# url: ${{ steps.deployment.outputs.page_url }}
175-
# runs-on: ubuntu-latest
176-
# needs: build-static
177-
# steps:
178-
# - name: Deploy to GitHub Pages
179-
# id: deployment
180-
# uses: actions/deploy-pages@v4
174+
# deploy-static:
175+
# environment:
176+
# name: github-pages
177+
# url: ${{ steps.deployment.outputs.page_url }}
178+
# runs-on: ubuntu-latest
179+
# needs: build-static
180+
# steps:
181+
# - name: Deploy to GitHub Pages
182+
# id: deployment
183+
# uses: actions/deploy-pages@v4
181184

182185
deploy-main:
183186
name: 'Deploy to Dev'
@@ -195,16 +198,16 @@ jobs:
195198
webhook_url: ${{ secrets.PORTAINER_WEBHOOK_URL }}
196199

197200
deploy-production:
198-
name: 'Deploy to Production'
199-
needs: release-container
200-
runs-on: ubuntu-latest
201-
if: github.ref == 'refs/heads/production'
202-
environment:
203-
name: production
204-
url: https://wsaf.org.uk
205-
206-
steps:
207-
- name: Trigger Portainer Deployment
208-
uses: newarifrh/portainer-service-webhook@v1
209-
with:
210-
webhook_url: ${{ secrets.PORTAINER_WEBHOOK_URL }}
201+
name: 'Deploy to Production'
202+
needs: release-container
203+
runs-on: ubuntu-latest
204+
if: (github.event_name == 'push' && github.ref == 'refs/heads/production') || github.event_name == 'release'
205+
environment:
206+
name: production
207+
url: https://wsaf.org.uk
208+
209+
steps:
210+
- name: Trigger Portainer Deployment
211+
uses: newarifrh/portainer-service-webhook@v1
212+
with:
213+
webhook_url: ${{ secrets.PORTAINER_WEBHOOK_URL }}

0 commit comments

Comments
 (0)