-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Continuous Integration and Docker publishing workflows
- Loading branch information
Showing
3 changed files
with
121 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
version: 2 | ||
|
||
updates: | ||
# NPM | ||
- package-ecosystem: "npm" # See documentation for possible values | ||
directory: "/node-app" # Location of package manifests | ||
schedule: | ||
interval: "daily" | ||
|
||
# GitHub Actions | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Continuous Integration | ||
|
||
on: | ||
push: | ||
branches: | ||
- '**' | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
name: Build (Node ${{matrix.node}}) | ||
|
||
strategy: | ||
matrix: | ||
node: ['12', '15'] | ||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
- name: Github setup & checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
persist-credentials: false | ||
|
||
- name: Setup Node.js ${{matrix.node}} | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: ${{matrix.node}} | ||
|
||
- name: CI Build & Install | ||
run: | | ||
cd node-app | ||
npm install | ||
npm run build --if-present |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
name: Docker to ghcr.io | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
workflow_dispatch: | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Run tests | ||
run: docker-compose --file docker-compose.yml build | ||
|
||
push: | ||
needs: test | ||
|
||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
|
||
- name: Set up Docker Builder | ||
id: buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Available platforms | ||
run: echo ${{ steps.buildx.outputs.platforms }} | ||
|
||
- name: Log into GitHub Container Registry | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GCR_PAT }} | ||
|
||
- name: Setup Environment | ||
run: | | ||
echo "IMAGE=ghcr.io/${{ github.repository }}" >> $GITHUB_ENV | ||
echo "VERSION=${GITHUB_REF#refs/*/v}" >> $GITHUB_ENV | ||
echo "GITHUB_SHORT_SHA=${GITHUB_SHA:1:7}" >> $GITHUB_ENV | ||
echo "GITHUB_REFNAME=${GITHUB_REF#refs/*/}" >> GITHUB_ENV | ||
echo "BUILD_DATE=$(date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_ENV | ||
- name: Build image and push | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: node-app | ||
platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64 | ||
labels: | | ||
org.opencontainers.image.title=EZ-HouseMode-SceneRunner | ||
org.opencontainers.image.authors=bruce@blacey.com | ||
org.opencontainers.image.source=https://github.com/${{ github.repository }} | ||
org.opencontainers.image.description=Created from commit ${{ env.GITHUB_SHORT_SHA }}, (ref ${{ env.GITHUB_REF_NAME }}) | ||
org.opencontainers.image.created=${{ env.BUILD_DATE }} | ||
org.opencontainers.image.revision=${{ github.sha }} | ||
org.opencontainers.image.ref.name=${{ env.GITHUB_REFNAME }} | ||
org.opencontainers.image.version=${{ env.VERSION }} | ||
tags: | | ||
${{ env.IMAGE }}:latest | ||
${{ env.IMAGE }}:${{ env.VERSION }} | ||
push: true | ||
|
||
- name: Image digest | ||
run: echo ${{ steps.docker_build.outputs.digest }} |