mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-05-05 05:47:10 -04:00
87 lines
2.5 KiB
YAML
87 lines
2.5 KiB
YAML
name: Docker nightly release
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
schedule:
|
|
- cron: '0 0 * * *'
|
|
|
|
jobs:
|
|
check_date:
|
|
runs-on: ubuntu-latest
|
|
name: Check latest commit
|
|
outputs:
|
|
should_run: ${{ steps.should_run.outputs.should_run }}
|
|
steps:
|
|
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
|
|
- name: print latest_commit
|
|
run: echo ${{ github.sha }}
|
|
|
|
- id: should_run
|
|
continue-on-error: true
|
|
name: check latest commit is less than a day
|
|
if: ${{ github.event_name == 'schedule' }}
|
|
run: test -z $(git rev-list --after="24 hours" ${{ github.sha }}) && echo "::set-output name=should_run::false"
|
|
|
|
ci:
|
|
runs-on: ubuntu-latest
|
|
needs: check_date
|
|
if: ${{ needs.check_date.outputs.should_run != 'false' }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
|
|
- run: corepack enable
|
|
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4
|
|
with:
|
|
node-version: 16
|
|
cache: 'pnpm'
|
|
|
|
- name: Install dependencies
|
|
run: pnpm i
|
|
|
|
- name: Run linters
|
|
run: pnpm lint
|
|
|
|
- name: Run unit test
|
|
run: pnpm test
|
|
|
|
- name: Build the app
|
|
run: pnpm build
|
|
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
needs:
|
|
- ci
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
|
|
|
|
- name: Login to GitHub Container Registry
|
|
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5
|
|
with:
|
|
context: .
|
|
file: ./Dockerfile
|
|
platforms: linux/amd64,linux/arm64
|
|
push: true
|
|
tags: |
|
|
thetechnetwork/it-tools:nightly
|
|
ghcr.io/thetechnetwork/it-tools:nightly
|