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

87 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:
permissions:
actions: none
checks: none
contents: read
deployments: none
issues: none
packages: none
pull-requests: none
repository-projects: none
security-events: none
statuses: none
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.1
- 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:
runs-on: ubuntu-20.04
strategy:
matrix:
job:
- arch
- centos
- ubuntu
name: images/${{ matrix.job}}
steps:
- name: Cancel previous runs
if: github.event_name == 'pull_request'
uses: styfle/cancel-workflow-action@0.9.1
- name: Checkout
uses: actions/checkout@v2
- name: Build ${{ matrix.job }} images
run: |
${{ github.workspace }}/scripts/build_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: |
${{ github.workspace}}/scripts/push_images.sh \
--tag=${{ matrix.job}}