This repository has been archived by the owner on Jul 14, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
469 additions
and
311 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,32 +3,88 @@ name: Build and push Docker image | |
|
||
on: | ||
push: | ||
branches: | ||
branches-ignore: | ||
- main | ||
- master | ||
- develop | ||
- feature/* | ||
- release/* | ||
- hotfix/* | ||
tags: | ||
- '[0-9]*' | ||
|
||
pull_request: | ||
- dependabot/* | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [8.x, 10.x, 12.x] | ||
redis-version: [5] | ||
steps: | ||
- name: Git checkout | ||
uses: actions/checkout@v1 | ||
- name: Start Mailcatcher | ||
run: docker run --name mailcatcher --publish 1025:1025 --detach schickling/mailcatcher | ||
- name: Start MongoDB | ||
uses: supercharge/[email protected] | ||
- name: Start Redis | ||
uses: supercharge/[email protected] | ||
with: | ||
redis-version: ${{ matrix.redis-version }} | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- run: npm install | ||
- run: npm run build | ||
- run: npm test | ||
env: | ||
CI: true | ||
|
||
build_and_push: | ||
needs: | ||
- test | ||
runs-on: ubuntu-18.04 | ||
if: (contains(github.event.head_commit.message, '[skip ci]') == false) && (github.event_name == 'push') | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
|
||
- name: Docker meta Service Name | ||
id: docker_meta_img | ||
uses: docker/metadata-action@v3 | ||
with: | ||
images: ghcr.io/${{ github.repository }} | ||
tags: | | ||
type=ref,event=branch,enable=false,priority=600 | ||
type=sha,enable=true,priority=600,prefix= | ||
- name: Log into registry | ||
run: echo "${{ secrets.DOCKER_TOKEN }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin | ||
|
||
- name: Build image | ||
run: make build | ||
|
||
- name: Push image | ||
run: make push | ||
|
||
- name: Cleanup | ||
run: make clean | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ secrets.GH_DOCKER_USERNAME }} | ||
password: ${{ secrets.GH_DOCKER_TOKEN }} | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Build and push ${{ github.repository }} | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
platforms: linux/amd64 | ||
push: true | ||
tags: ghcr.io/${{ github.repository }}:${{ github.sha }} | ||
labels: ${{ steps.docker_meta_img.outputs.labels }} | ||
|
||
dispatch: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- build_and_push | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Extract branch name | ||
shell: bash | ||
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" | ||
id: extract_branch | ||
- name: Repository Dispatch | ||
uses: peter-evans/repository-dispatch@v1 | ||
with: | ||
token: ${{ secrets.REPO_ACCESS_TOKEN }} | ||
repository: hpi-schul-cloud/dof_app_deploy | ||
event-type: dev-deploy | ||
client-payload: '{"branch": "${{ steps.extract_branch.outputs.branch}}" }' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
--- | ||
name: Build and push Docker Image on Main | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- master | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [8.x, 10.x, 12.x] | ||
redis-version: [5] # [4, 5] | ||
steps: | ||
- name: Git checkout | ||
uses: actions/checkout@v1 | ||
- name: Start Mailcatcher | ||
run: docker run --name mailcatcher --publish 1025:1025 --detach schickling/mailcatcher | ||
- name: Start MongoDB | ||
uses: supercharge/[email protected] | ||
- name: Start Redis | ||
uses: supercharge/[email protected] | ||
with: | ||
redis-version: ${{ matrix.redis-version }} | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- run: npm install | ||
- run: npm run build | ||
- run: npm test | ||
env: | ||
CI: true | ||
|
||
build_and_push: | ||
needs: | ||
- test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Docker meta Service Name | ||
id: docker_meta_img | ||
uses: crazy-max/ghaction-docker-meta@v2 | ||
with: | ||
images: ghcr.io/${{ github.repository }} | ||
tags: | | ||
type=ref,event=branch,enable=false,priority=600 | ||
type=sha,enable=true,priority=600,prefix= | ||
- name: Log into registry | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ secrets.GHCR_DOCKER_USERNAME }} | ||
password: ${{ secrets.GHCR_DOCKER_TOKEN }} | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Build and push ${{ github.repository }} | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
platforms: linux/amd64 | ||
push: true | ||
tags: ghcr.io/${{ github.repository }}:${{ github.sha }} | ||
labels: ${{ steps.docker_meta_img.outputs.labels }} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
--- | ||
name: Build and push Docker Image on Tag | ||
|
||
on: | ||
push: | ||
tags: | ||
- '[0-9]*' | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [8.x, 10.x, 12.x] | ||
redis-version: [5] # [4, 5] | ||
steps: | ||
- name: Git checkout | ||
uses: actions/checkout@v1 | ||
- name: Start Mailcatcher | ||
run: docker run --name mailcatcher --publish 1025:1025 --detach schickling/mailcatcher | ||
- name: Start MongoDB | ||
uses: supercharge/[email protected] | ||
- name: Start Redis | ||
uses: supercharge/[email protected] | ||
with: | ||
redis-version: ${{ matrix.redis-version }} | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- run: npm install | ||
- run: npm run build | ||
- run: npm test | ||
env: | ||
CI: true | ||
|
||
build_and_push: | ||
needs: | ||
- test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Docker meta Service Name for docker hub | ||
id: docker_meta_img_hub | ||
uses: docker/metadata-action@v3 | ||
with: | ||
images: schulcloud/schulcloud-server | ||
tags: | | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}}.{{minor}} | ||
- name: Log into registry | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_TOKEN }} | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Build and push ${{ github.repository }} | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
platforms: linux/amd64 | ||
push: true | ||
tags: ${{ steps.docker_meta_img_hub.outputs.tags }} | ||
labels: ${{ steps.docker_meta_img_hub.outputs.labels }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.