Updating license #2
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: Docker Image CI | |
on: | |
push: | |
branches: | |
- 'main' | |
pull_request: | |
branches: | |
- 'main' | |
env: | |
TEST_CONTAINER_TAG: "ghcr.io/${{github.repository}}:${{github.sha}}" | |
RELEASE_CONTAINER_TAG: "ghcr.io/${{github.repository}}:latest" | |
jobs: | |
build_test: | |
name: Build Test Container | |
runs-on: ubuntu-latest | |
steps: | |
- name: Login to Registry | |
run: >- | |
echo "${{ secrets.GITHUB_TOKEN }}" | |
| docker login ghcr.io -u $ --password-stdin | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Build Test Container | |
# in bash, `${ENVIRONMENT_VARIABLE,,}` lowercases whatever is stored in `ENVIRONMENT_VARIABLE` | |
run: >- | |
docker build | |
--pull | |
--build-arg CORES="$(nproc)" | |
--tag "${TEST_CONTAINER_TAG,,}" | |
${{github.workspace}} | |
- name: Push Test Container | |
run: >- | |
docker push "${TEST_CONTAINER_TAG,,}" | |
- name: Push Latest Tag | |
if: ${{github.ref_name == 'main'}} | |
run: | | |
docker pull "${TEST_CONTAINER_TAG,,}" | |
docker tag "${TEST_CONTAINER_TAG,,}" "${RELEASE_CONTAINER_TAG,,}" | |
docker push "${RELEASE_CONTAINER_TAG,,}" |