coder-enterprise-images/.github/workflows/build.yaml

84 lines
1.8 KiB
YAML

name: build
on:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
# Run at 2am UTC
- cron: "0 2 * * *"
workflow_dispatch:
jobs:
# Quick checks, running linters, checking formatting, etc
quick:
runs-on: ubuntu-20.04
steps:
- name: Cancel previous runs
if: github.event_name == 'pull_request'
uses: styfle/cancel-workflow-action@0.9.0
- name: Checkout
uses: actions/checkout@v2
- name: Install Node.js
uses: actions/setup-node@v2
with:
node-version: 12.x
- name: Install Node.js modules
run: yarn install
- name: Check formatting
run: yarn format:check
images:
name: images/${{ matrix.job}}
runs-on: ubuntu-20.04
strategy:
matrix:
job:
- arch
- centos
- ubuntu
fail-fast: false
steps:
- name: Cancel previous runs
if: github.event_name == 'pull_request'
uses: styfle/cancel-workflow-action@0.9.0
- name: Checkout
uses: actions/checkout@v2
- name: Install dependencies
run: ./scripts/install_deps.sh
- name: Build ${{ matrix.job }} images
run: |
./scripts/build_images.sh \
--tag=${{ matrix.job }}
- name: Scan ${{ matrix.job }} container images
run: |
./scripts/scan_images.sh \
--tag=${{ matrix.job }}
- name: Authenticate to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push images to Docker Hub
if: github.event_name != 'pull_request'
run: |
./scripts/push_images.sh \
--tag=${{ matrix.job}}