Skip to content

Commit

Permalink
split into 2 CI workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
andyli committed Sep 13, 2021
1 parent a470fc0 commit 70e8684
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 36 deletions.
45 changes: 9 additions & 36 deletions .github/workflows/ci.yml → .github/workflows/ci-dev.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
name: CI
name: CI-dev

on:
push:
branches:
- development
branches-ignore:
- master
workflow_dispatch:

jobs:
build-dev:
if: github.ref == 'refs/heads/development'
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -27,8 +25,8 @@ jobs:
with:
name: haxelib-server-image
path: /tmp/haxelib-server-image.tar
push-dev:
needs: build-dev
push:
needs: build
if: success() && ( github.repository == 'HaxeFoundation/haxelib' )
runs-on: ubuntu-latest
steps:
Expand All @@ -48,8 +46,8 @@ jobs:
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push image
run: docker push haxe/lib.haxe.org:${{ github.sha }}
test-dev:
needs: push-dev
test:
needs: push
runs-on: ubuntu-latest
container: haxe/haxelib_devcontainer_workspace:20210906154938
services:
Expand Down Expand Up @@ -97,8 +95,8 @@ jobs:
- run: neko run.n run tora > ~/tora.log 2>&1 &
- run: haxe ci.hxml
- run: neko bin/ci.n || (echo "[BUILD FAILED]" && echo "Tora log:" && cat ~/tora.log && false)
deploy-dev:
needs: test-dev
deploy:
needs: test
concurrency: deploy
runs-on: ubuntu-latest
container: haxe/haxelib_devcontainer_workspace:20210906154938
Expand All @@ -120,28 +118,3 @@ jobs:
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
TF_VAR_HAXELIB_DB_PASS: ${{ secrets.TF_VAR_HAXELIB_DB_PASS }}
TF_VAR_HAXELIB_SERVER_IMAGE_DEVELOPMENT: haxe/lib.haxe.org:${{ github.sha }}
deploy-prod:
if: github.ref == 'refs/heads/master'
concurrency: deploy
runs-on: ubuntu-latest
container: haxe/haxelib_devcontainer_workspace:20210906154938
env:
AWS_DEFAULT_REGION: eu-west-1
TF_INPUT: 0
TF_IN_AUTOMATION: 1
steps:
# make sure the image exists
- run: docker manifest inspect haxe/lib.haxe.org:${{ github.sha }}
- uses: actions/checkout@v2
- run: terraform init
working-directory: terraform
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- run: terraform apply -auto-approve
working-directory: terraform
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
TF_VAR_HAXELIB_DB_PASS: ${{ secrets.TF_VAR_HAXELIB_DB_PASS }}
TF_VAR_HAXELIB_SERVER_IMAGE_MASTER: haxe/lib.haxe.org:${{ github.sha }}
33 changes: 33 additions & 0 deletions .github/workflows/ci-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: CI-prod

on:
push:
branches:
- master
workflow_dispatch:

jobs:
deploy-prod:
concurrency: deploy
runs-on: ubuntu-latest
container: haxe/haxelib_devcontainer_workspace:20210906154938
env:
AWS_DEFAULT_REGION: eu-west-1
TF_INPUT: 0
TF_IN_AUTOMATION: 1
steps:
# make sure the image exists
- run: docker manifest inspect haxe/lib.haxe.org:${{ github.sha }}
- uses: actions/checkout@v2
- run: terraform init
working-directory: terraform
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- run: terraform apply -auto-approve
working-directory: terraform
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
TF_VAR_HAXELIB_DB_PASS: ${{ secrets.TF_VAR_HAXELIB_DB_PASS }}
TF_VAR_HAXELIB_SERVER_IMAGE_MASTER: haxe/lib.haxe.org:${{ github.sha }}

0 comments on commit 70e8684

Please sign in to comment.