forked from pypsa-meets-earth/pypsa-earth
-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (53 loc) · 1.52 KB
/
devcontainer.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
56
57
58
59
60
61
name: Dev Container Build and Push Image
on:
workflow_dispatch:
push:
branches:
- "main"
tags:
- "v*.*.*"
pull_request:
branches: [main]
jobs:
build-and-push:
strategy:
fail-fast: false
matrix:
os:
- [ubuntu-latest]
- [macos-latest]
runs-on: ${{ matrix.os }}
steps:
-
name: Checkout
id: checkout
uses: actions/checkout@v1
- name: Setup Colima (Docker alternative for macOS)
if: runner.os == 'macOS'
run: |
brew install colima docker
colima start --cpu 2 --memory 4
# Wait for Docker to be ready
while ! docker info >/dev/null 2>&1; do sleep 1; done
-
name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_TOKEN }}
-
name: Build Dev Container Image
uses: devcontainers/[email protected]
with:
subFolder: .github
imageName: ghcr.io/${{ github.repository }}
cacheFrom: ghcr.io/${{ github.repository }}
push: never
- name: Test Container Image
run: |
docker run --rm ghcr.io/${{ github.repository }} /bin/bash -c "git clone -b devContainers https://github.com/drifter089/pypsa-earth.git && cd pypsa-earth && bash .github/.devcontainer/test.sh"
- name: Push Container Image
if: ${{ success() }}
run: |
docker push ghcr.io/${{ github.repository }}