mirror of
https://github.com/swissmakers/swiss-datashare.git
synced 2026-03-26 11:13:25 +01:00
add CI/CD pipeline for automatically build the container
This commit is contained in:
39
.gitea/workflows/build-harbor.yml
Normal file
39
.gitea/workflows/build-harbor.yml
Normal file
@@ -0,0 +1,39 @@
|
||||
name: Build and Push to Harbor when new commit to main-branch
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: linux_amd64
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Login to Harbor (Robot)
|
||||
if: ${{ secrets.HARBOR_REGISTRY && secrets.HARBOR_USERNAME && secrets.HARBOR_PASSWORD }}
|
||||
env:
|
||||
REGISTRY: ${{ secrets.HARBOR_REGISTRY }}
|
||||
ROBOT_USER: ${{ secrets.HARBOR_USERNAME }}
|
||||
ROBOT_PASS: ${{ secrets.HARBOR_PASSWORD }}
|
||||
run: |
|
||||
mkdir -p "$HOME/.config/containers"
|
||||
echo "$ROBOT_PASS" | podman login --username "$ROBOT_USER" --password-stdin "$REGISTRY"
|
||||
|
||||
|
||||
- name: Build & tag
|
||||
env:
|
||||
REG: ${{ secrets.HARBOR_REGISTRY }}
|
||||
PROJ: ${{ secrets.HARBOR_PROJECT }}
|
||||
run: |
|
||||
podman build -t $REG/$PROJ/swiss-datashare:${{ github.sha }} .
|
||||
podman tag $REG/$PROJ/swiss-datashare:${{ github.sha }} $REG/$PROJ/swiss-datashare:latest
|
||||
|
||||
- name: Push
|
||||
env:
|
||||
REG: ${{ secrets.HARBOR_REGISTRY }}
|
||||
PROJ: ${{ secrets.HARBOR_PROJECT }}
|
||||
run: |
|
||||
podman push $REG/$PROJ/swiss-datashare:${{ github.sha }}
|
||||
podman push $REG/$PROJ/swiss-datashare:latest
|
||||
Reference in New Issue
Block a user