-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (53 loc) · 1.69 KB
/
build_and_publish.yaml
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
name: CD - Statocles
on:
pull_request:
push:
branches:
- '*'
tags-ignore:
- '*'
jobs:
perl-job:
env:
GIT_COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
runs-on: ['ubuntu-latest']
container:
image: perl
strategy:
fail-fast: true
name: Statocles, build or publish.
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
name: Do checkout
- name: Setup Perl environment
run: |
echo PERL5LIB="$(pwd)/lib:$(pwd)/local/lib/perl5${PERL5LIB:+:PERL5LIB}" >> $GITHUB_ENV
echo PERL_VERSION="$(perl -E 'print $^V')" >> $GITHUB_ENV
cat .env >> $GITHUB_ENV
echo "$(pwd)/local/bin" >> $GITHUB_PATH
- name: Configure git
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git branch --track ${{ env.PUBLISH_BRANCH }} origin/${{ env.PUBLISH_BRANCH }}
- name: Cache dependencies
uses: actions/cache@v2
with:
path: local
key: ${{ runner.os }}-cache-deps-${{ env.PERL_VERSION }}-${{ hashFiles('cpanfile') }}
- name: Get dependencies
run: |
cpanm --notest --verbose Carton
carton install
- name: Build site for PR
if: github.event_name == 'pull_request'
run: |
chmod +x "${GITHUB_WORKSPACE}/.github/scripts/build.sh"
bash ${GITHUB_WORKSPACE}/.github/scripts/build.sh
- name: Publish site
if: github.event_name == 'push'
run: |
chmod +x "${GITHUB_WORKSPACE}/.github/scripts/publish.sh"
bash ${GITHUB_WORKSPACE}/.github/scripts/publish.sh