Skip to content

Commit 536ec50

Browse files
committed
chore: fix deploy to github-pages
Signed-off-by: Maximillian Arruda <[email protected]>
1 parent 47ed58c commit 536ec50

File tree

1 file changed

+40
-29
lines changed

1 file changed

+40
-29
lines changed

.github/workflows/github-pages.yml

Lines changed: 40 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -15,36 +15,47 @@ on:
1515
jobs:
1616
# This workflow contains a single job called "build"
1717
build:
18+
name: Build and prepare to deploy
1819
# The type of runner that the job will run on
1920
runs-on: ubuntu-latest
21+
2022
strategy:
21-
matrix:
22-
node-version: [16.x]
23-
base_href: [vagas-java]
24-
work_dir: [front-end]
25-
# Steps represent a sequence of tasks that will be executed as part of the job
23+
matrix:
24+
node-version: [16.x]
25+
workDir: [./front-end]
26+
base_href: [vagas-java]
27+
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
28+
2629
steps:
27-
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
28-
- uses: actions/checkout@v3
29-
30-
- name: Angular Deploy gh-pages Actions
31-
# You may pin to the exact commit or the version.
32-
# uses: AhsanAyaz/angular-deploy-gh-pages-actions@0e4f1a953d00116ca38fbf1bcdb37f91923015ef
33-
uses: AhsanAyaz/[email protected]
34-
with:
35-
# Github access token token used to deploy on gh_pages. You can find it on Github.
36-
github_access_token: ${{ secrets.GITHUB_TOKEN }}
37-
# The directory of the angular project, in which all the commands will run. It's optional, default is ./
38-
angular_project_dir: ${{ matrix.work_dir }}
39-
# Build configuration for the angular app
40-
build_configuration: production # optional, default is production
41-
# base href for the app
42-
base_href: /${{ matrix.base_href }}/ # optional, default is /
43-
# branch on which the angular build will be deployed
44-
deploy_branch: gh-pages # optional, default is gh-pages
45-
# The folder in which `ng build` provides its output. This is the folder which will be deployed to the `deploy_branch`.
46-
angular_dist_build_folder: ${{ matrix.work_dir }}/dist # optional, default is dist
47-
# If the action should run 'ng lint'
48-
# run_lint: # optional
49-
# Will not fail the step if anything fails
50-
# skip_failure: # optional
30+
- uses: actions/checkout@v3
31+
32+
- name: Cache node modules
33+
uses: actions/cache@v3
34+
with:
35+
path: ~/.npm
36+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
37+
restore-keys: |
38+
${{ runner.os }}-node-
39+
40+
- name: Setup Node.js ${{ matrix.node-version }}
41+
uses: actions/setup-node@v3
42+
with:
43+
node-version: ${{ matrix.node-version }}
44+
45+
- name: Install Dependencies
46+
working-directory: ${{ matrix.workDir }}
47+
run: npm install
48+
49+
- name: Build Application
50+
working-directory: ${{ matrix.workDir }}
51+
run: npm run build -- --configuration=production --base-href=/${{ matrix.base_href }}/
52+
53+
54+
- name: Deploy to GitHub Pages
55+
if: success()
56+
uses: crazy-max/ghaction-github-pages@v3
57+
with:
58+
target_branch: gh-pages
59+
build_dir: ${{ matrix.work_dir }}/dist
60+
env:
61+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)