-
Notifications
You must be signed in to change notification settings - Fork 43
Improve cd action #70
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
Draft
PythonGermany
wants to merge
5
commits into
rust-github:main
Choose a base branch
from
PythonGermany:improve-cd-action
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
92d7f0a
Merge pull request #2 from rust-github/main
PythonGermany 79e3e67
feat(cd): Use dynamic username
PythonGermany 0a93bf8
feat(cd): Simplify updating example repo
PythonGermany 220ac3e
feat(cd): Check if repo is empty and initialize it
PythonGermany 17ce85f
fix(cd): Set git user config
PythonGermany File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,50 +17,42 @@ jobs: | |
with: | ||
name: ${{ env.PROJECT_NAME }} | ||
template: template | ||
arguments: "--template-values-file .github/workflows/template_values.toml --verbose" | ||
arguments: "--template-values-file .github/workflows/template_values.toml -d gh-username=${{ github.repository_owner }} --verbose" | ||
|
||
- name: Generate lockfile | ||
run: | | ||
cd $PROJECT_NAME | ||
cargo generate-lockfile | ||
|
||
- name: Check for references | ||
run: | | ||
if git ls-remote --exit-code [email protected]:${{ github.repository_owner }}/${{ env.PROJECT_NAME }}.git; then | ||
echo "References found in the remote repo" | ||
else | ||
echo "No references found in the remote repo" | ||
mkdir tmp && cd tmp | ||
git config user.name github-actions | ||
git config user.email [email protected] | ||
git init | ||
git branch -M main | ||
git remote add origin [email protected]:PythonGermany/rust-gh-example.git | ||
git commit --allow-empty -m "Initial commit" | ||
git push -u origin main | ||
rm -rf tmp | ||
fi | ||
|
||
- name: Checkout old example | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: rust-github/rust-gh-example | ||
path: old_example | ||
repository: ${{ github.repository_owner }}/${{ env.PROJECT_NAME }} | ||
path: ${{ env.PROJECT_NAME }}.old | ||
ssh-key: ${{ secrets.GH_EXAMPLE_DEPLOY_SECRET }} | ||
|
||
- name: move sources, mit license and Cargo.toml from old to new example | ||
run: | | ||
echo "pwd:" | ||
pwd | ||
echo "ls -al:" | ||
ls -al | ||
rm rust-gh-example/src/main.rs | ||
rm rust-gh-example/Cargo.toml | ||
rm rust-gh-example/LICENSE-MIT | ||
cp old_example/src/* rust-gh-example/src/ | ||
cp old_example/Cargo.toml rust-gh-example/Cargo.toml | ||
cp old_example/LICENSE-MIT rust-gh-example/LICENSE-MIT | ||
- name: update example | ||
run: | | ||
mkdir old_sources | ||
mv old_example/src/* old_sources | ||
cd old_example | ||
rm -rf * .gitignore .github/ | ||
echo "ls ../rust-gh-example:" | ||
ls ../rust-gh-example | ||
echo "ls ../rust-gh-example/src:" | ||
ls ../rust-gh-example/src | ||
mv ../rust-gh-example/* ../rust-gh-example/.github ../rust-gh-example/.gitignore . | ||
echo "ls -al:" | ||
ls -al | ||
rm src/* | ||
mv ../old_sources/* src | ||
run: cp -rf ${{ env.PROJECT_NAME }}.old/.git ${{ env.PROJECT_NAME }} | ||
- name: commit example | ||
run: | | ||
cd old_example | ||
cd ${{ env.PROJECT_NAME }} | ||
git config user.name github-actions | ||
git config user.email [email protected] | ||
git add . | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.