-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (54 loc) · 1.71 KB
/
test-build.yml
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
name: Docker Image test
on:
workflow_dispatch: null
push:
branches: test
paths:
- '.github/workflows/test-build.yaml'
- 'Desktop/**'
- 'apt.txt'
- 'user-dirs.dirs'
- 'vscode-extensions.txt'
- 'environment.yml'
- 'start'
- 'postBuild'
- 'Dockerfile'
- 'custom_jupyter_server_config.json'
- 'scripts/**'
- '!book/**' # Ignore all changes in the /book directory
- '!docs/**' # Ignore all changes in the /docs directory
- '!base-image/**'
- '!README.md'
- '!conda-lock.yml'
- '!LICENSE'
jobs:
build:
runs-on: ubuntu-latest
permissions: write-all
steps:
- uses: actions/checkout@v3
with:
ref: test
- name: Login to GitHub Container Registry
if: github.repository == 'nmfs-opensci/py-rocket-base'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}
- name: Create short_sha tag
shell: bash
run: |
short_sha=$(echo "${{ github.sha }}" | cut -c1-7)
echo "tag=${short_sha}" >> $GITHUB_ENV
- name: Build the Docker image
if: github.repository == 'nmfs-opensci/py-rocket-base'
run: |
docker build . -f Dockerfile \
--tag ghcr.io/nmfs-opensci/py-rocket-base/test:latest \
--tag ghcr.io/nmfs-opensci/py-rocket-base/test:${{ env.tag }}
- name: Publish
if: github.repository == 'nmfs-opensci/py-rocket-base'
run: |
docker push ghcr.io/nmfs-opensci/py-rocket-base/test:latest
docker push ghcr.io/nmfs-opensci/py-rocket-base/test:${{ env.tag }}