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

fix: Make sure our bot is used for released #1116

Merged
merged 1 commit into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"baseBranch": "origin/main",
"updateInternalDependencies": "patch",
"ignore": [
"@react-native-async-storage/eslint-config",
Expand Down
19 changes: 19 additions & 0 deletions .github/scripts/setup-ci-git-user.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh

if [ -z ${CI+x} ]
then
# not on CI
exit 0
fi

if [ -z ${GITHUB_NAME+x} ] || [ -z ${GITHUB_EMAIL+x} ] || [ -z ${GITHUB_TOKEN+x} ]
then
echo "Make sure GITHUB_NAME, GITHUB_EMAIL and GITHUB_TOKEN variables are set"
exit 1
fi

git config --global user.name "$GITHUB_NAME"
git config --global user.email "$GITHUB_EMAIL"
echo "machine github.com login $GITHUB_NAME password $GITHUB_TOKEN" > ~/.netrc


6 changes: 2 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ jobs:
uses: ./.github/actions/setup-project
- name: Install dependencies
run: yarn
- name: Setup git user
run: |
git config --global user.name ${{ secrets.GH_BOT_NAME }}
git config --global user.email ${{ secrets.GH_BOT_EMAIL }}
- name: Version or release packages
uses: changesets/action@v1
with:
Expand All @@ -26,4 +22,6 @@ jobs:
version: "yarn release:version"
env:
GITHUB_TOKEN: ${{ secrets.GH_RELEASE_TOKEN }}
GITHUB_NAME: ${{ secrets.GH_BOT_NAME }}
GITHUB_EMAIL: ${{ secrets.GH_BOT_EMAIL }}
NPM_TOKEN: ${{ secrets.NPM_RELEASE_TOKEN }}
15 changes: 10 additions & 5 deletions .github/workflows/website-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,15 @@ jobs:
- name: Install dependencies
run: yarn
working-directory: ./packages/website
- name: Setup git user
run: setup-ci-git-user.sh
working-directory: ./.github/scripts
env:
GITHUB_TOKEN: ${{ secrets.GH_RELEASE_TOKEN }}
GITHUB_NAME: ${{ secrets.GH_BOT_NAME }}
GITHUB_EMAIL: ${{ secrets.GH_BOT_EMAIL }}
- name: Deploy
run: |
git config --global user.name ${{ secrets.GH_BOT_NAME }}
git config --global user.email ${{ secrets.GH_BOT_EMAIL }}
echo "machine github.com login ${{ secrets.GH_BOT_NAME }} password ${{ secrets.GH_RELEASE_TOKEN }}" > ~/.netrc
GIT_USER=${{ secrets.GH_BOT_NAME }} yarn run deploy
env:
GIT_USER: ${{ secrets.GH_BOT_NAME }}
run: yarn run deploy
working-directory: ./packages/website
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"test:lint": "turbo run test:lint",
"test:ts": "turbo run test:ts",
"test:format": "prettier --check --loglevel warn $(git ls-files '*.js' '*.json' '*.ts' '*.tsx' '*.yml' 'README.md')",
"release:version": "changeset version",
"release:publish": "changeset publish"
"release:version": "./.github/scripts/setup-ci-git-user.sh && changeset version",
"release:publish": "./.github/scripts/setup-ci-git-user.sh && changeset publish"
},
"devDependencies": {
"@changesets/changelog-github": "^0.5.0",
Expand Down