Skip to content

Update main.yml

Update main.yml #21

Workflow file for this run

name: Build crustbags-manager (main)
on:
workflow_dispatch:
push:
branches: [ "main" ]
jobs:
build:
if: github.repository == 'crustio/crustbags-manager'
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- uses: actions/cache@v3
with:
path: |
.yarn/cache
./node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn install
- name: Build
run: yarn build
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Get current date
id: date
run: echo "date=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_ENV
- name: Build and push
id: docker_build
uses: docker/build-push-action@v3
with:
context: .
file: ./Dockerfile
push: true
tags: |
crustio/crustbags-manager:latest
crustio/crustbags-manager:${{ env.date }}