Skip to content

Commit

Permalink
Add workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Hialus committed Mar 5, 2024
1 parent 49b7d11 commit 5c3982e
Showing 1 changed file with 71 additions and 0 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Build

on:
pull_request:
paths-ignore:
- 'README.md'
- 'LICENSE'
- '.github/**'
- '!.github/workflows/build.yml'
push:
branches:
- main
tags: '[0-9]+.[0-9]+.[0-9]+'
paths-ignore:
- 'README.md'
- 'LICENSE'
- '.github/**'
- '!.github/workflows/build.yml'
release:
types:
- created

jobs:
docker:
name: Build and Push Docker Image
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'ls1intum/Pyris' }}
runs-on: ubuntu-latest
steps:
- name: Compute Tag
uses: actions/github-script@v6
id: compute-tag
with:
result-encoding: string
script: |
if (context.eventName === "pull_request") {
return "pr-" + context.issue.number;
}
if (context.eventName === "release") {
return "latest";
}
if (context.eventName === "push") {
if (context.ref.startsWith("refs/tags/")) {
return context.ref.slice(10);
}
if (context.ref === "refs/heads/main") {
return "latest";
}
}
return "FALSE";
- uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
# Build and Push to GitHub Container Registry
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
if: ${{ steps.compute-tag.outputs.result != 'FALSE' }}
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push to GitHub Container Registry
uses: docker/build-push-action@v4
if: ${{ steps.compute-tag.outputs.result != 'FALSE' }}
with:
platforms: amd64, arm64
file: ./Dockerfile
context: .
tags: ghcr.io/ls1intum/pyris:${{ steps.compute-tag.outputs.result }}
push: true

0 comments on commit 5c3982e

Please sign in to comment.