diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 02a0c928d..0c559547d 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -4,9 +4,9 @@ // For format details, see https://aka.ms/devcontainer.json. { "name": "pypsa earth dev", - "image": "ghcr.io/drifter089/pypsa-earth:latest", + "image": "ghcr.io/pypsa-meets-earth/pypsa-earth:latest", "workspaceMount": "source=${localWorkspaceFolder},target=/workspaces,type=bind,consistency=cached", - "initializeCommand": "docker pull ghcr.io/drifter089/pypsa-earth:latest", + "initializeCommand": "docker pull ghcr.io/pypsa-meets-earth/pypsa-earth:latest", "workspaceFolder": "/workspaces", "postAttachCommand": "bash .devcontainer/setup.sh" } diff --git a/.github/workflows/devcontainer.yml b/.github/workflows/devcontainer.yml index ec5b4cdf0..9b6e1219b 100644 --- a/.github/workflows/devcontainer.yml +++ b/.github/workflows/devcontainer.yml @@ -7,26 +7,39 @@ on: paths: - envs/linux-pinned.yaml +env: + IMAGE_NAME: pypsa-earth +# jobs: - build: + # This pushes the image to GitHub Packages. + push: runs-on: ubuntu-latest - + permissions: + packages: write + contents: read + # steps: - - name: Checkout - id: checkout - uses: actions/checkout@v4 + - uses: actions/checkout@v4 + + - name: Build image + run: docker build . --file Dockerfile --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}" - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ secrets.REGISTRY_USER }} - password: ${{ secrets.REGISTRY_TOKEN }} + - name: Log in to registry + run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin + # + - name: Push image + run: | + IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME - - name: Build Dev Container Image - uses: devcontainers/ci@v0.3 - with: - subFolder: .github - cacheFrom: ghcr.io/${{ github.repository }}-dev-env - imageName: ghcr.io/${{ github.repository }}-dev-env - push: always + # This changes all uppercase characters to lowercase. + IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') + # This strips the git ref prefix from the version. + VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') + # This strips the "v" prefix from the tag name. + [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') + # This uses the Docker `latest` tag convention. + [ "$VERSION" == "main" ] && VERSION=latest + echo IMAGE_ID=$IMAGE_ID + echo VERSION=$VERSION + docker tag $IMAGE_NAME $IMAGE_ID:$VERSION + docker push $IMAGE_ID:$VERSION diff --git a/doc/release_notes.rst b/doc/release_notes.rst index 90eb8fdf6..244f5be80 100644 --- a/doc/release_notes.rst +++ b/doc/release_notes.rst @@ -47,6 +47,8 @@ This part of documentation collects descriptive release notes to capture the mai * Fix namibia geofk, line country tag mismatch and minor fixes `PR #1330 `__ +* Minor revision docker workflow to have it working on upstream `PR #1343 `__ + PyPSA-Earth 0.6.0 =================