Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract install-action-manifest-schema and publish to crates-io #657

Open
wants to merge 24 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
4637998
Extract manifest-schema and publish to crates-io
NobodyXu Sep 21, 2024
ae50c4d
Set install-action-internal-codegen to publish=false
NobodyXu Sep 21, 2024
d553f9c
Rename crate to install-action-manifest-schema
NobodyXu Sep 21, 2024
5014667
Add GHA workflow `manifest-sync.yml`
NobodyXu Oct 2, 2024
d4b617c
Add `MANIFEST_SCHEMA_BRANCH_NAME` to manifest-schema
NobodyXu Oct 2, 2024
207eeeb
Fix `Show diff` step in `manifest_sync.yml`
NobodyXu Oct 2, 2024
f667532
Fix `checkout-manifest-schema-branch.sh`
NobodyXu Oct 2, 2024
9e1fdfc
Remove unused key in concurrency group
NobodyXu Oct 2, 2024
054782f
Update tools/checkout-manifest-schema-branch.sh
NobodyXu Oct 14, 2024
9498496
Run `manifest_sync.yml` on release
NobodyXu Oct 14, 2024
0319866
Revert unnecessary `publish = false` in `codegen/Cargo.toml`
NobodyXu Oct 14, 2024
2360c8b
Make getting version of install-action-manifest-schema more robust
NobodyXu Oct 14, 2024
8b80c3f
Update tools/checkout-manifest-schema-branch.sh
NobodyXu Oct 14, 2024
061321d
Add license to install-action-manifest-schema
NobodyXu Oct 15, 2024
e64fbb2
Fix checkout-manifest-schema-branch.sh fmt
NobodyXu Oct 15, 2024
64ceee1
Fix speeing
NobodyXu Oct 15, 2024
3e1c3fb
Add license line to checkout-manifest-schema-branch.sh
NobodyXu Oct 15, 2024
3bdda34
Fix manifest_sync.yml: Limit permission `contents: read`
NobodyXu Oct 15, 2024
bcbd71a
Fix file-permissions-check in tools/tidy.sh
NobodyXu Dec 11, 2024
b768746
Update tools/codegen/Cargo.toml
taiki-e Jan 9, 2025
e0d9941
Update tools/tidy.sh
taiki-e Jan 9, 2025
42ee9cd
Merge branch 'main' into refactor/new-crate-for-parsing-manifest
taiki-e Jan 9, 2025
783123c
touch up
taiki-e Jan 9, 2025
bbf1578
mv script to correct dir
taiki-e Jan 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/.cspell/project-dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ syft
udeps
wasmtime
watchexec
worktree
xbuild
xscale
zigbuild
51 changes: 51 additions & 0 deletions .github/workflows/manifest_sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Manifest Synchronization

permissions:
contents: read

on:
release:
types: [released]

env:
WORKSPACE: /tmp/workspace

defaults:
run:
shell: bash --noprofile --norc -CeEuxo pipefail {0}

jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: true

- name: Checkout manifest-schema branch
run: ./tools/ci/checkout-manifest-schema-branch.sh $WORKSPACE

- name: Copy over schema
run: cp ./manifests/* $WORKSPACE

- name: Stage changes
working-directory: ${{ env.WORKSPACE }}
run: git add .

- name: Show diff
working-directory: ${{ env.WORKSPACE }}
run: git diff HEAD

- name: Detect changes
id: changes
working-directory: ${{ env.WORKSPACE }}
run: |
# This output boolean tells us if the dependencies have actually changed
echo "count=$(git status --porcelain=v1 | wc -l)" >> $GITHUB_OUTPUT

- name: Commit and push
# Only push if changes exist
if: steps.changes.outputs.count > 0
working-directory: ${{ env.WORKSPACE }}
run: |
git commit -m "Update manifest schema" && git push origin HEAD
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[workspace]
resolver = "2"
members = ["tools/codegen"]
members = ["tools/codegen", "tools/manifest-schema"]

# This table is shared by projects under github.com/taiki-e.
# It is not intended for manual editing.
Expand Down
23 changes: 23 additions & 0 deletions tools/ci/checkout-manifest-schema-branch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash
# SPDX-License-Identifier: Apache-2.0 OR MIT

set -euxo pipefail

cd "$(dirname "$0")"

schema_version="$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name == "install-action-manifest-schema") | .version')"
branch="manifest-schema-${schema_version}"
Comment on lines +8 to +9
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But branch name here is manifest-schema-<major>.<minor>.<patch>.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should use manifest-schema-<major>.<minor> until manifest-schema crate become 1.x, as I said in #657 (comment).


git worktree add --force "${1?}"
cd "$1"

if git fetch origin "${branch}"; then
git checkout "origin/${branch}" -B "${branch}"
elif ! git checkout "${branch}"; then
# New branch with no history. Credit: https://stackoverflow.com/a/13969482
git checkout --orphan "${branch}"
git rm -rf . || true
git config --local user.name github-actions
git config --local user.email [email protected]
git commit -m 'Initial commit' --allow-empty
fi
1 change: 1 addition & 0 deletions tools/codegen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ edition = "2021"
default-run = "generate-manifest"

[dependencies]
install-action-manifest-schema = { path = "../manifest-schema" }
anyhow = "1"
flate2 = "1"
fs-err = "3"
Expand Down
Loading
Loading