-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (50 loc) · 1.51 KB
/
build.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
name: Build the Docker Container
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
release:
types: [ created ]
env:
REGISTRY: ghcr.io
IMAGE_NAME: talusbio/bioconda-tools
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build the Docker image
uses: docker/build-push-action@v2
with:
context: .
load: true
tags: ${{ env.IMAGE_NAME }}:test
- name: Test the Docker image
run: |
docker run --rm ${IMAGE_NAME}:test comet -p
docker run --rm ${IMAGE_NAME}:test ps
- name: Log in to the GitHub Container Registry
if: ${{ github.event_name == 'release' }}
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata for Docker
if: ${{ github.event_name == 'release' }}
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# Note that the image is cached from the test build, so it won't be build a
# second time. Correspondingly, this step only pushes it to the GitHub
# Container Registry.
- name: Push the Docker image to the GHCR
uses: docker/build-push-action@v2
if : ${{ github.event_name == 'release' }}
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}