Skip to content

Merge pull request #1 from bmeme/first-import #1

Merge pull request #1 from bmeme/first-import

Merge pull request #1 from bmeme/first-import #1

Workflow file for this run

---
name: Release Bmeme NG-CLI container images
on:
push:
branches:
- "main"
schedule:
- cron: 00 00 */7 * *
env:
registry: docker.io
repository: bmeme/ng-cli
jobs:
configure:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
-
name: Checkout to repository
uses: actions/checkout@v3
-
name: Set matrix data
id: set-matrix
run: echo "matrix=$(jq -c . < ./config.json)" >> $GITHUB_OUTPUT
build:
name: Build and push Bmeme NG-CLI container images
runs-on: ubuntu-latest
needs: configure
strategy:
matrix: ${{ fromJson(needs.configure.outputs.matrix) }}
steps:
-
name: Check out the codebase.
uses: actions/checkout@v3
-
name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build images
id: build
env:
NG_CLI_MAJOR_VERSION: ${{ matrix.ng_cli_major_version }}
NODE_MAJOR_VERSION: ${{ matrix.node_major_version }}
PRETTY_TAG: ${{ matrix.name }}
run: |
{
docker build \
--build-arg NODE_MAJOR_VERSION=${NODE_MAJOR_VERSION} \
--build-arg NG_CLI_MAJOR_VERSION=${NG_CLI_MAJOR_VERSION} \
-t ${{ env.registry}}/${{ env.repository }}:${PRETTY_TAG} \
-f ./Dockerfile .;
}
-
name: Get NG_CLI_VERSION value
id: get-ng-cli-version
env:
NG_CLI_MAJOR_VERSION: ${{ matrix.ng_cli_major_version }}
NODE_MAJOR_VERSION: ${{ matrix.node_major_version }}
PRETTY_TAG: ${{ matrix.name }}
run: |
{
echo "ng_cli_version=$(docker run --rm ${{ env.registry}}/${{ env.repository }}:${PRETTY_TAG} /bin/bash -c \
'cat /home/node/.ng_cli_version')" >> "$GITHUB_OUTPUT"; \
}
-
name: Tag and push images
id: tag
env:
NG_CLI_MAJOR_VERSION: ${{ matrix.ng_cli_major_version }}
NODE_MAJOR_VERSION: ${{ matrix.node_major_version }}
PRETTY_TAG: ${{ matrix.name }}
NG_CLI_VERSION: ${{ steps.get-ng-cli-version.outputs.ng_cli_version }}
run: |
{
docker tag ${{ env.registry}}/${{ env.repository }}:${PRETTY_TAG} \
${{ env.registry}}/${{ env.repository }}:${NG_CLI_VERSION}-${NODE_MAJOR_VERSION}; \
docker push ${{ env.registry}}/${{ env.repository }}:${PRETTY_TAG}; \
docker push ${{ env.registry}}/${{ env.repository }}:${NG_CLI_VERSION}-${NODE_MAJOR_VERSION}; \
if ${{ matrix.latest }}; then
docker tag ${{ env.registry}}/${{ env.repository }}:${PRETTY_TAG} ${{ env.registry}}/${{ env.repository }}:latest; \
docker push ${{ env.registry}}/${{ env.repository }}:latest
fi
}