Skip to main content

Github Action

caution
  • 不支持允许错误 #399
info
  • golangci-lint-action CI 耗时非常长 #297

step

  • id
  • if name uses run shell with env continue-on-error timeout-minutes

uses

# {owner}/{repo}@{ref}
# {owner}/{repo}/{path}@{ref}
- uses: actions/checkout@v3
- uses: actions/aws/ec2@main

# 相同仓库 - 需要先 checkout
# ./path/to/dir
- uses: ./.github/actions/my-action
# docker://{image}:{tag}
# docker://{host}/{image}:{tag}
- uses: docker://alpine:3.8
- uses: docker://ghcr.io/OWNER/IMAGE_NAME
- uses: docker://gcr.io/cloud-builders/gradle

# private repo
- uses: actions/checkout@v3
with:
repository: octocat/my-private-repo
ref: v1.0
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
path: ./.github/actions/my-private-repo
# from private repo
- uses: ./.github/actions/my-private-repo/my-action

pnpm template

name: Build

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
build:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16
- uses: pnpm/action-setup@v2.0.1
name: Install pnpm
id: pnpm-install
with:
version: 7
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
- name: Build Cache
id: build-cache
uses: actions/cache@v2
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

# Real build
- run: make ci

- name: Deploy Pages
uses: JamesIves/github-pages-deploy-action@releases/v4
with:
branch: gh-pages
folder: out
single-commit: true

FAQ

compile: version does not match go tool version

- name: Run CI
run: |
export PATH=${GOROOT}/bin:$PATH
go version