Skip to content

Commit

Permalink
ci: Unify workflow names and orders. (#293)
Browse files Browse the repository at this point in the history
  • Loading branch information
huxuan authored Jan 29, 2024
1 parent 508a8fd commit e1b77b9
Show file tree
Hide file tree
Showing 16 changed files with 100 additions and 92 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/devcontainer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.ref }}
jobs:
devcontainer_prebuild:
dev-container-publish:
permissions:
contents: read
packages: write
Expand Down
50 changes: 25 additions & 25 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
name: Release
jobs:
package:
needs: release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pdm-project/setup-pdm@v4
with:
cache: true
python-version: '3.12'
- run: env | sort
- env:
PDM_PUBLISH_PASSWORD: ${{ secrets.PDM_PUBLISH_PASSWORD }}
PDM_PUBLISH_USERNAME: ${{ vars.PDM_PUBLISH_USERNAME != '' && vars.PDM_PUBLISH_USERNAME || '__token__' }}
run: make publish
pages-build:
runs-on: ubuntu-latest
steps:
Expand All @@ -36,17 +22,7 @@ jobs:
uses: actions/upload-pages-artifact@v3
with:
path: public
pages-deploy:
needs: release
permissions:
id-token: write
pages: write
runs-on: ubuntu-latest
steps:
- id: deployment
name: Deploy to GitHub Pages
uses: actions/deploy-pages@v4
release:
release-publish:
needs: pages-build
permissions:
contents: write
Expand Down Expand Up @@ -77,6 +53,30 @@ jobs:
with:
body_path: release-notes.md
prerelease: ${{ steps.prerelease.outputs.is_prerelease }}
package-publish:
needs: release-publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pdm-project/setup-pdm@v4
with:
cache: true
python-version: '3.12'
- run: env | sort
- env:
PDM_PUBLISH_PASSWORD: ${{ secrets.PDM_PUBLISH_PASSWORD }}
PDM_PUBLISH_USERNAME: ${{ vars.PDM_PUBLISH_USERNAME != '' && vars.PDM_PUBLISH_USERNAME || '__token__' }}
run: make publish
pages:
needs: release-publish
permissions:
id-token: write
pages: write
runs-on: ubuntu-latest
steps:
- id: deployment
name: Deploy to GitHub Pages
uses: actions/deploy-pages@v4
on:
push:
tags:
Expand Down
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ default:
before_script:
- env | sort
image: ${CI_REGISTRY_IMAGE}:dev-py3.12
include: .gitlab/ci/**.yml
include: .gitlab/workflows/**.yml
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
devcontainer-prebuild:
dev-container-publish:
image: docker:latest
interruptible: true
parallel:
Expand Down
2 changes: 1 addition & 1 deletion .gitlab/ci/mr.yml → .gitlab/workflows/mr.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
lint_title:
lint-title:
interruptible: true
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
doc:
pages-build:
artifacts:
paths:
- public
Expand All @@ -11,9 +11,21 @@ doc:
- make doc
- make release-notes > release-notes.md
stage: release
package:
release-publish:
image: registry.gitlab.com/gitlab-org/release-cli:latest
needs:
- pages-build
release:
description: release-notes.md
tag_name: $CI_COMMIT_TAG
rules:
- if: $CI_COMMIT_TAG =~ /^v?(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-?(a|b|rc)(0|[1-9][0-9]*)?)?$/
script:
- echo "Running the release job."
stage: release
package-publish:
needs:
- release
- release-publish
rules:
- if: $CI_COMMIT_TAG =~ /^v?(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-?(a|b|rc)(0|[1-9][0-9]*)?)?$/
script:
Expand All @@ -24,22 +36,9 @@ pages:
paths:
- public
needs:
- release
- doc
- release-publish
rules:
- if: $CI_COMMIT_TAG =~ /^v?(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-?(a|b|rc)(0|[1-9][0-9]*)?)?$/
script:
- echo "Running the pages job."
stage: release
release:
image: registry.gitlab.com/gitlab-org/release-cli:latest
needs:
- doc
release:
description: release-notes.md
tag_name: $CI_COMMIT_TAG
rules:
- if: $CI_COMMIT_TAG =~ /^v?(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-?(a|b|rc)(0|[1-9][0-9]*)?)?$/
script:
- echo "Running the release job."
stage: release
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@
"min_py",
"max_py",
"default_py",
"id-token",
"pages-build",
"release-publish",
"package-publish",
"pages",
"3.8",
"3.9",
"3.10",
Expand Down
5 changes: 5 additions & 0 deletions template/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@
"min_py",
"max_py",
"default_py",
"id-token",
"pages-build",
"release-publish",
"package-publish",
"pages",
"3.8",
"3.9",
"3.10",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ concurrency:
cancel-in-progress: true
group: {{ '${{ github.workflow }}-${{ github.ref }}' }}
jobs:
devcontainer_prebuild:
dev-container-publish:
permissions:
contents: read
packages: write
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
name: Release
jobs:
package:
needs: release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pdm-project/setup-pdm@v4
with:
cache: true
python-version: '{{ default_py }}'
- run: env | sort
- env:
PDM_PUBLISH_PASSWORD: {{ '${{ secrets.PDM_PUBLISH_PASSWORD }}' }}
PDM_PUBLISH_USERNAME: {{ '${{ vars.PDM_PUBLISH_USERNAME != \'\' && vars.PDM_PUBLISH_USERNAME || \'__token__\' }}' }}
run: make publish
pages-build:
runs-on: ubuntu-latest
steps:
Expand All @@ -36,17 +22,7 @@ jobs:
uses: actions/upload-pages-artifact@v3
with:
path: public
pages-deploy:
needs: release
permissions:
id-token: write
pages: write
runs-on: ubuntu-latest
steps:
- id: deployment
name: Deploy to GitHub Pages
uses: actions/deploy-pages@v4
release:
release-publish:
needs: pages-build
permissions:
contents: write
Expand Down Expand Up @@ -77,6 +53,30 @@ jobs:
with:
body_path: release-notes.md
prerelease: {{ '${{ steps.prerelease.outputs.is_prerelease }}' }}
package-publish:
needs: release-publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pdm-project/setup-pdm@v4
with:
cache: true
python-version: '{{ default_py }}'
- run: env | sort
- env:
PDM_PUBLISH_PASSWORD: {{ '${{ secrets.PDM_PUBLISH_PASSWORD }}' }}
PDM_PUBLISH_USERNAME: {{ '${{ vars.PDM_PUBLISH_USERNAME != \'\' && vars.PDM_PUBLISH_USERNAME || \'__token__\' }}' }}
run: make publish
pages:
needs: release-publish
permissions:
id-token: write
pages: write
runs-on: ubuntu-latest
steps:
- id: deployment
name: Deploy to GitHub Pages
uses: actions/deploy-pages@v4
on:
push:
tags:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ default:
before_script:
- env | sort
image: ${CI_REGISTRY_IMAGE}:dev-py{{ default_py }}
include: .gitlab/ci/**.yml
include: .gitlab/workflows/**.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
devcontainer-prebuild:
dev-container-publish:
image: docker:latest
interruptible: true
parallel:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
lint_title:
lint-title:
interruptible: true
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
doc:
pages-build:
artifacts:
paths:
- public
Expand All @@ -11,9 +11,21 @@ doc:
- make doc
- make release-notes > release-notes.md
stage: release
package:
release-publish:
image: registry.gitlab.com/gitlab-org/release-cli:latest
needs:
- pages-build
release:
description: release-notes.md
tag_name: $CI_COMMIT_TAG
rules:
- if: $CI_COMMIT_TAG =~ /^v?(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-?(a|b|rc)(0|[1-9][0-9]*)?)?$/
script:
- echo "Running the release job."
stage: release
package-publish:
needs:
- release
- release-publish
rules:
- if: $CI_COMMIT_TAG =~ /^v?(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-?(a|b|rc)(0|[1-9][0-9]*)?)?$/
script:
Expand All @@ -24,22 +36,9 @@ pages:
paths:
- public
needs:
- release
- doc
- release-publish
rules:
- if: $CI_COMMIT_TAG =~ /^v?(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-?(a|b|rc)(0|[1-9][0-9]*)?)?$/
script:
- echo "Running the pages job."
stage: release
release:
image: registry.gitlab.com/gitlab-org/release-cli:latest
needs:
- doc
release:
description: release-notes.md
tag_name: $CI_COMMIT_TAG
rules:
- if: $CI_COMMIT_TAG =~ /^v?(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-?(a|b|rc)(0|[1-9][0-9]*)?)?$/
script:
- echo "Running the release job."
stage: release

0 comments on commit e1b77b9

Please sign in to comment.