Skip to content

Commit

Permalink
Merge pull request #21 from zong-zhe/republish-all-pkgs
Browse files Browse the repository at this point in the history
feat: add workflow to supports manual republishing all kcl packages
  • Loading branch information
Peefy authored Oct 27, 2023
2 parents 10c4bca + bd12f35 commit 48797e1
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 1 deletion.
60 changes: 60 additions & 0 deletions .github/workflows/update_all_metadatas.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Republish All Packages

on:
push:
branches:
- main

env:
KPM_REG: "docker.io"
KPM_REPO: "kcllang"

jobs:
publish_pkg:
# NOTE:
# - This is limited to pull_request* events and would raise an error for other events.
# - A maximum of 3000 files can be returned.
# - For more flexibility and no limitations see "Using local .git history" above.

runs-on: ubuntu-latest
name: Update Package Info on AH
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.19

- name: Install kpm
run: go install kcl-lang.io/kpm@latest

- name: login
run: kpm login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} docker.io

- name: republish to docker.io
run: |
find . -name "kcl.mod" -execdir bash -c 'echo Pushing in directory: "$PWD" && kpm push || echo Failed to push in directory: "$PWD"' \;
- name: republish to ghcr.io
run: |
kpm login -u ${{ secrets.DEPLOY_ACCESS_NAME }} -p ${{ secrets.DEPLOY_ACCESS_TOKEN }} ghcr.io
find . -name "kcl.mod" -execdir bash -c 'echo Pushing in directory: "$PWD" && kpm push || echo Failed to push in directory: "$PWD"' \;
env:
KPM_REG: "ghcr.io"
KPM_REPO: "kcl-lang"

- name: regenerate artifacthub-pkg.yaml
run: |
find . -name "kcl.mod" -exec bash -c 'file="{}" && echo Running for file: "$file" && go run main.go "$file" || echo Failed to run for file: "$file"' \;
- name: Commit and push changes
run: |
git config --global user.name 'GitHub Action'
git config --global user.email '[email protected]'
git add .
git commit -m "Regenerate artifacthub-pkg.yaml for all packages"
git push
2 changes: 1 addition & 1 deletion .github/workflows/update_metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,5 @@ jobs:
git config --global user.email '[email protected]'
git add .
git commit -m "Updata artifacthub-pkg.yaml for ${{ github.event.registry_package.name }}"
git commit -m "Updata artifacthub-pkg.yaml"
git push

0 comments on commit 48797e1

Please sign in to comment.