-
Notifications
You must be signed in to change notification settings - Fork 73
87 lines (83 loc) · 2.54 KB
/
cd.yaml
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: CD
on:
push:
branches:
- main
tags:
- v*
pull_request:
branches:
- main
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
KL_FILE: klayout_0.29.0-1_amd64.deb
KL_HASH: 421df42661a3d795b534da5048261044
jobs:
build-and-push-docker:
name: Docker
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10.x'
- name: Log in to the Container registry
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
file: ci/Dockerfile
build-args: |
KL_FILE=${{ env.KL_FILE }}
KL_HASH=${{ env.KL_HASH }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-and-push-singularity:
name: Singularity
runs-on: ubuntu-latest
container:
image: quay.io/singularity/singularity:v3.10.2
options: --privileged
permissions:
contents: read
packages: write
if: github.event_name != 'pull_request'
steps:
- uses: actions/checkout@v2
- name: Extract metadata (tags, labels)
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Install dependencies
run: apk update && apk add debootstrap perl
- name: Build Container
run: |
cd singularity && ./singularity.sh
echo "Tag is ${{ steps.meta.outputs.tags }}."
- name: Login and Deploy Container
working-directory: ./singularity/libexec
shell: bash
run: |
echo ${{ secrets.GITHUB_TOKEN }} | singularity remote login -i -u ${{ github.repository_owner }} \
--password-stdin oras://ghcr.io
# loop over tags separated with newlines
while IFS= read -r remote; do
singularity push -U kqclib "oras://${remote}-singularity"
done <<< "${{ steps.meta.outputs.tags }}"