Skip to content
Latchkey

Create Release workflow (dromara/domain-admin)

The Create Release workflow from dromara/domain-admin, explained and optimized by Latchkey.

F

CI health: F - at risk

Point runs-on at Latchkey and get caching, run de-duplication, job timeouts, SHA-pinned actions, self-healing for flaky steps, and up to 58% lower cost, applied automatically.

Grade your own workflow free or run it on Latchkey →
Source: dromara/domain-admin.github/workflows/release-tag.ymlLicense MITView source

What it does

This is the Create Release workflow from the dromara/domain-admin repository, a real project running GitHub Actions. It is shown here with attribution under its MIT license.

Below, Latchkey shows a faster, safer version produced by its optimization engine.

The workflow

workflow (.yml)
#https://github.com/yyx990803/release-tag

name: Create Release

on:
  push:
    tags:
      - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

#on:
#  push:
#    branch: ['master']

jobs:
  build:
    name: Create Release
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Master
        uses: actions/checkout@master

      # 拉取web前端dist的代码
      - name: Checkout Web Dist
        uses: actions/checkout@v3
        with:
          repository: 'mouday/domain-admin-web'
          ref: 'dist'
          token: ${{ secrets.GH_PAT }}
          path: 'domain_admin/public'

      - name: Checkout Mini Dist
        uses: actions/checkout@v3
        with:
          repository: 'mouday/domain-admin-mini'
          ref: 'dist'
          token: ${{ secrets.GH_PAT }}
          path: 'domain_admin/public/m'

      - name: Set up Python
        uses: actions/setup-python@v3
        with:
          python-version: '3.x'

      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          pip install setuptools wheel twine

      - name: Build Dist
        run: |
            python setup.py sdist bdist_wheel --python-tag py2.py3

      # 拉取前端最新的master代码
      - name: Checkout Web Master
        uses: actions/checkout@v3
        with:
          repository: 'mouday/domain-admin-web'
          ref: 'master'
          token: ${{ secrets.GH_PAT }}
          path: 'domain_admin_web'

      # https://github.com/a7ul/tar-action
      # https://docs.github.com/zh/actions/learn-github-actions/contexts#github-context
      - name: Compress action step Web
        uses: a7ul/tar-action@v1.1.0
        id: compress-web
        with:
          command: c
          cwd: ./
          files: |
            ./domain_admin_web
          outPath: ./dist/domain-admin-web-${{github.ref_name}}.tar.gz

      # 拉取H5前端最新的master代码
      - name: Checkout Mini Master
        uses: actions/checkout@v3
        with:
          repository: 'mouday/domain-admin-mini'
          ref: 'master'
          token: ${{ secrets.GH_PAT }}
          path: 'domain_admin_mini'

      # remove .git
      - name: Remove .git Dir
        run: rm -rf '.git' 'domain_admin/public/.git' 'domain_admin/public/m/.git'

      - name: Compress action step Mini
        uses: a7ul/tar-action@v1.1.0
        id: compress-mini
        with:
          command: c
          cwd: ./
          files: |
            ./domain_admin_mini
          outPath: ./dist/domain-admin-mini-${{github.ref_name}}.tar.gz

      - name: Release
        uses: softprops/action-gh-release@v1
        if: startsWith(github.ref, 'refs/tags/')
        with:
          files: ./dist/*
          body: Please refer to [CHANGELOG.md](https://domain-admin.readthedocs.io/zh_CN/latest/manual/changelog.html) for details.
          # note you'll typically need to create a personal access token
          # with permissions to create releases in the other repo

The same workflow, on Latchkey

Estimated ~20% faster on cache hits, plus fewer wasted runs and a safer supply chain. Added and changed lines are highlighted.

#https://github.com/yyx990803/release-tag
 
name: Create Release
 
on:
  push:
    tags:
      - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
 
#on:
#  push:
#    branch: ['master']
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  build:
    timeout-minutes: 30
    name: Create Release
    runs-on: latchkey-small
    steps:
      - name: Checkout Master
        uses: actions/checkout@master
 
      # 拉取web前端dist的代码
      - name: Checkout Web Dist
        uses: actions/checkout@v3
        with:
          repository: 'mouday/domain-admin-web'
          ref: 'dist'
          token: ${{ secrets.GH_PAT }}
          path: 'domain_admin/public'
 
      - name: Checkout Mini Dist
        uses: actions/checkout@v3
        with:
          repository: 'mouday/domain-admin-mini'
          ref: 'dist'
          token: ${{ secrets.GH_PAT }}
          path: 'domain_admin/public/m'
 
      - name: Set up Python
        uses: actions/setup-python@v3
        with:
          cache: 'pip'
          python-version: '3.x'
 
      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          pip install setuptools wheel twine
 
      - name: Build Dist
        run: |
            python setup.py sdist bdist_wheel --python-tag py2.py3
 
      # 拉取前端最新的master代码
      - name: Checkout Web Master
        uses: actions/checkout@v3
        with:
          repository: 'mouday/domain-admin-web'
          ref: 'master'
          token: ${{ secrets.GH_PAT }}
          path: 'domain_admin_web'
 
      # https://github.com/a7ul/tar-action
      # https://docs.github.com/zh/actions/learn-github-actions/contexts#github-context
      - name: Compress action step Web
        uses: a7ul/tar-action@v1.1.0
        id: compress-web
        with:
          command: c
          cwd: ./
          files: |
            ./domain_admin_web
          outPath: ./dist/domain-admin-web-${{github.ref_name}}.tar.gz
 
      # 拉取H5前端最新的master代码
      - name: Checkout Mini Master
        uses: actions/checkout@v3
        with:
          repository: 'mouday/domain-admin-mini'
          ref: 'master'
          token: ${{ secrets.GH_PAT }}
          path: 'domain_admin_mini'
 
      # remove .git
      - name: Remove .git Dir
        run: rm -rf '.git' 'domain_admin/public/.git' 'domain_admin/public/m/.git'
 
      - name: Compress action step Mini
        uses: a7ul/tar-action@v1.1.0
        id: compress-mini
        with:
          command: c
          cwd: ./
          files: |
            ./domain_admin_mini
          outPath: ./dist/domain-admin-mini-${{github.ref_name}}.tar.gz
 
      - name: Release
        uses: softprops/action-gh-release@v1
        if: startsWith(github.ref, 'refs/tags/')
        with:
          files: ./dist/*
          body: Please refer to [CHANGELOG.md](https://domain-admin.readthedocs.io/zh_CN/latest/manual/changelog.html) for details.
          # note you'll typically need to create a personal access token
          # with permissions to create releases in the other repo
 

What changed

2 third-party actions are referenced by a movable tag. Pin them to the commit SHA (Latchkey resolves and applies this automatically) so a repointed tag cannot change what runs.

What Latchkey heals here

This workflow has steps that commonly fail on transient issues (network, registries, flaky browsers). On Latchkey managed runners they are detected, retried, and self-healed instead of failing your build:

This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.

Actions used in this workflow