-
-
Notifications
You must be signed in to change notification settings - Fork 96
44 lines (42 loc) · 1.62 KB
/
ci.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
name: CI
on: ["push", "pull_request"]
env:
FORCE_COLOR: 1
EARTHLY_STRICT: "true"
DEPLOY: "${{ ( github.repository_owner == 'HaxeFoundation' ) && ( github.event_name == 'push' ) && ( ( github.ref == 'refs/heads/staging' ) || ( github.ref == 'refs/heads/master' ) ) }}"
jobs:
job:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions/checkout@v3
with:
repository: HaxeFoundation/HaxeManual
path: manual
- uses: earthly/actions-setup@v1
with:
version: "0.7.2"
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build
run: earthly +generate --GIT_BRANCH=${{ github.ref_name }}
- name: Create .envrc
if: success() && env.DEPLOY == 'true'
run: |
cat > .envrc <<EOT
export AWS_DEFAULT_REGION='${{ vars.AWS_DEFAULT_REGION }}'
export AWS_ACCESS_KEY_ID='${{ vars.AWS_ACCESS_KEY_ID }}'
export AWS_SECRET_ACCESS_KEY='$AWS_SECRET_ACCESS_KEY'
export S3_BUCKET='${{ vars.S3_BUCKET }}'
export GIT_BRANCH='${{ github.ref_name }}'
export CLOUDFRONT_DISTRIBUTION_ID_STAGING='${{ vars.CLOUDFRONT_DISTRIBUTION_ID_STAGING }}'
export CLOUDFRONT_DISTRIBUTION_ID_MASTER='${{ vars.CLOUDFRONT_DISTRIBUTION_ID_MASTER }}'
EOT
env:
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Deploy
if: success() && env.DEPLOY == 'true'
run: earthly +deploy --GIT_BRANCH=${{ github.ref_name }}
env:
EARTHLY_SECRET_FILES: .envrc=.envrc