Wener Notes

Github Action

约 2 分钟阅读

step

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

uses

yaml
# {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

yaml
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/[email protected]
        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

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

关联信息

反向链接、本文链接的其他页面和外部资料。

反向链接

  • Gitea Action
    笔记 · Action

    参考 · Github Action · Runner · vs Github Action · Mirror · https://github.com/actions/checkout · https://gitea.com/actions/checkout

References

GitHub5 条
其他外链2 条
最近更新commit 9483fedEdit

On this page