distro-tools/.github/workflows/push_containers.yaml
2023-02-02 03:31:10 +01:00

38 lines
1.3 KiB
YAML

name: Push containers
on:
push:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: bazelbuild/setup-bazelisk@v2
- name: Mount bazel cache # Optional
uses: actions/cache@v3
with:
path: "~/.cache/bazel"
key: bazel
- name: Log into GHCR
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin
- name: Push containers
run: |
export BUILD_TAG="${GIT_COMMIT:-$(git describe --tags --long --always)}"
bazel build //apollo/server/static
rm -rf apollo/server/static/*
cp bazel-bin/apollo/server/static/*.css apollo/server/static/
cp bazel-bin/apollo/server/static/*.js apollo/server/static/
cp bazel-bin/apollo/server/static/*.map apollo/server/static/
docker build -t ghcr.io/resf/apollo-server:$BUILD_TAG -f apollo/server/Dockerfile .
docker build -t ghcr.io/resf/apollo-rpmworker:$BUILD_TAG -f apollo/rpmworker/Dockerfile .
docker build -t ghcr.io/resf/apollo-rhworker:$BUILD_TAG -f apollo/rhworker/Dockerfile .
docker push ghcr.io/resf/apollo-server:$BUILD_TAG
docker push ghcr.io/resf/apollo-rpmworker:$BUILD_TAG
docker push ghcr.io/resf/apollo-rhworker:$BUILD_TAG