Contributing some changes back #36
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 & Release | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
env: | |
REGISTRY: ghcr.io | |
jobs: | |
build_release: | |
permissions: write-all | |
name: "Build and Release" | |
strategy: | |
matrix: | |
VERSIONS: [ {ruby: 2.7.3, ghpages: 226}, {ruby: 2.7.4, ghpages: 228}] | |
NODE_MAJOR_VERSION: [16,18,20] | |
runs-on: ubuntu-latest | |
env: | |
RUBY_VERSION: ${{ matrix.VERSIONS.ruby }} | |
NODE_MAJOR_VERSION: ${{ matrix.NODE_MAJOR_VERSION }} | |
GITHUB_PAGES_VERSION: ${{ matrix.VERSIONS.ghpages }} | |
steps: | |
- name: Lowercase repo for IMAGE_NAME | |
run: | | |
echo "IMAGE_NAME=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV} | |
- uses: actions/checkout@v3 | |
- name: Build the Docker image | |
run: docker build . --file Dockerfile --tag ${REGISTRY}/${IMAGE_NAME}:ruby${RUBY_VERSION}-node${NODE_MAJOR_VERSION} --build-arg RUBY_VERSION=${RUBY_VERSION} --build-arg NODE_MAJOR_VERSION=${NODE_MAJOR_VERSION} --build-arg BUILD_DATE=$(date -u +%Y-%m-%d_%H-%M-%S) --build-arg VCS_REF=${GITHUB_SHA} --build-arg GH_PAGES_VERSION=${GITHUB_PAGES_VERSION} --progress=plain | |
- name: Inspect the built image | |
run: docker inspect ${REGISTRY}/${IMAGE_NAME}:ruby${RUBY_VERSION}-node${NODE_MAJOR_VERSION} | |
- name: Login to registry (non-PR only) | |
if: github.event_name != 'pull_request' | |
uses: docker/[email protected] | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push Container to registry (non-PR only) | |
if: github.event_name != 'pull_request' | |
run: docker push --all-tags ${REGISTRY}/${IMAGE_NAME} |