build #19
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
on: | |
workflow_dispatch: | |
branches: | |
- "main" | |
pull_request: | |
branches: | |
- "main" | |
schedule: | |
- cron: '0 0 1 * *' | |
jobs: | |
build: | |
permissions: | |
contents: read | |
packages: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Log in | |
if: github.event_name != 'pull_request' | |
run: | | |
echo "$TOKEN" | docker login ghcr.io --username "$USERNAME" --password-stdin | |
env: | |
TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
USERNAME: ${{ github.actor }} | |
- name: Build build base image | |
if: github.event_name != 'schedule' | |
run: | | |
docker build --tag ghcr.io/msys2/msys2-docker-build-base:latest ./build-base | |
- name: Build images | |
run: | | |
docker build --tag ghcr.io/msys2/msys2-docker-experimental:latest ./msys2 | |
docker build --tag ghcr.io/msys2/msys2-docker-devcontainer:latest ./devcontainer | |
- name: Save images | |
if: github.event_name == 'pull_request' | |
run: | | |
docker image save ghcr.io/msys2/msys2-docker-experimental:latest | zstd -T0 -c > experimental.tar.zst | |
docker image save ghcr.io/msys2/msys2-docker-devcontainer:latest | zstd -T0 -c > devcontainer.tar.zst | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
if: github.event_name == 'pull_request' | |
with: | |
name: docker-images | |
path: '*.tar.zst' | |
- name: Deploy build base image | |
if: github.event_name != 'pull_request' && github.event_name != 'schedule' | |
run: | | |
docker push ghcr.io/msys2/msys2-docker-build-base:latest | |
- name: Deploy images | |
if: github.event_name != 'pull_request' | |
run: | | |
docker push ghcr.io/msys2/msys2-docker-experimental:latest | |
docker push ghcr.io/msys2/msys2-docker-devcontainer:latest |