try to relogin - 2 #15
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: Deploy website | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get code | |
uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: npm ci | |
- name: Lint code | |
run: npm run lint | |
- name: Test code | |
run: npm run test | |
build: | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get code | |
uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: npm ci | |
- name: Build website | |
run: npm run build | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: dist-files | |
path: dist | |
# path: | | |
# dist | |
# package.json | |
deploy: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: dist-files | |
- name: Output contents | |
run: ls | |
- name: Deploy | |
run: | | |
echo "Deploying..." | |
git clone https://github-actions[bot]:${{ secrets.GITHUB_TOKEN }}@github.com/sheetal-purple/another repo # clone repo to track history | |
mv repo/.git . # move cloned git history to root | |
rm -rf repo | |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git add --force . | |
git commit -m "add contents of dist-files v${{ env.SPEC_VERSION }}" | |
git log | |
echo "${{ secrets.GITHUB_TOKEN }}" > token.txt | |
# Authorize GitHub CLI for the current repository and | |
# create a pull-requests containing the updates. | |
gh auth login --with-token < token.txt | |
git tag -a v${{ env.SPEC_VERSION }} -m "Update v${{ env.SPEC_VERSION }}" | |
git push origin master --follow-tags --force | |
env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SPEC_VERSION: 1.0.0 |