Skip to content

push contents to another repo #8

push contents to another repo

push contents to another repo #8

Workflow file for this run

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:"$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 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