Merge pull request #256 from kcl-lang/kubevirt-0.3.0 #246
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish Package | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- "**.mod" | |
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: | |
- name: Install kcl | |
run: wget -q https://kcl-lang.io/script/install-cli.sh -O - | /bin/bash | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
- name: Login | |
run: kcl registry login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} docker.io | |
- name: Get changed files | |
id: changed-files | |
uses: tj-actions/changed-files@v41 | |
- name: Publish to docker.io | |
run: | | |
if echo "${{ steps.changed-files.outputs.all_changed_files }}" | grep -q 'kcl.mod'; then | |
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do | |
./scripts/push_pkg_from.sh $file | |
done | |
fi | |
- name: Publish to ghcr.io | |
run: | | |
kcl registry login -u ${{ secrets.DEPLOY_ACCESS_NAME }} -p ${{ secrets.DEPLOY_ACCESS_TOKEN }} ghcr.io | |
if echo "${{ steps.changed-files.outputs.all_changed_files }}" | grep -q 'kcl.mod'; then | |
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do | |
./scripts/push_pkg_from.sh $file | |
done | |
fi | |
env: | |
KPM_REG: "ghcr.io" | |
KPM_REPO: "kcl-lang" | |
- name: Update artifacthub-pkg.yaml | |
run: | | |
if echo "${{ steps.changed-files.outputs.all_changed_files }}" | grep -q 'kcl.mod'; then | |
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do | |
go run main.go $file | |
done | |
fi | |
- name: Commit and push changes | |
run: | | |
if echo "${{ steps.changed-files.outputs.all_changed_files }}" | grep -q 'kcl.mod'; then | |
git config --global user.name 'GitHub Action' | |
git config --global user.email '[email protected]' | |
git add . | |
git commit -m "chore: update artifacthub-pkg.yaml" | |
git push | |
fi |