Skip to content

Build and Publish Dev Container #10

Build and Publish Dev Container

Build and Publish Dev Container #10

name: Build and Publish Dev Container
on:
workflow_dispatch: # Manually trigger a workflow run using the GitHub API, GitHub CLI, or the GitHub UI.
push:
branches:
- main
paths:
- .devcontainer/*
- .python-version
- pyproject.toml
schedule:
- cron: '30 15 10 * *'
permissions:
contents: read
packages: write
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}-dev-container
jobs:
build-and-publish:
if: github.repository == 'UCREL/pymusas'
runs-on: ubuntu-latest
steps:
- name: Lower case image name
run: |
LOWER_IMAGE_NAME=$(echo "${{ env.IMAGE_NAME }}" | tr '[:upper:]' '[:lower:]')
echo "LOWER_IMAGE_NAME=$LOWER_IMAGE_NAME" >> $GITHUB_ENV
- uses: actions/checkout@v5
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pre-build dev container image
uses: devcontainers/ci@8bf61b26e9c3a98f69cb6ce2f88d24ff59b785c6
with:
imageName: ${{ env.REGISTRY }}/${{ env.LOWER_IMAGE_NAME }}
cacheFrom: ${{ env.REGISTRY }}/${{ env.LOWER_IMAGE_NAME }}
push: always