Skip to content

Commit

Permalink
Merge pull request #43 from adafycheng/publish-to-gitlab
Browse files Browse the repository at this point in the history
v1.8.0 Push to GitLab
  • Loading branch information
adafycheng committed Mar 4, 2024
2 parents 0746a66 + a63dd18 commit bdfd4ec
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 4 deletions.
39 changes: 38 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
- run: npm run build --if-present
- run: npm test

deploy_github_pages:
push_to_github_pages:
needs: build
runs-on: ubuntu-latest

Expand Down Expand Up @@ -90,3 +90,40 @@ jobs:
git commit -m "Deploy $APP_VERSION"
git push origin "v$APP_VERSION"
push_to_gitlab:
needs: build
runs-on: ubuntu-latest

env:
GITLAB_REPO_URL: https://gitlab.com/adafycheng/portfolio-website-react
GITLAB_REPO_PATH: gitlab_repo

strategy:
matrix:
node-version: [ 20.x ]

steps:
- uses: actions/checkout@v3
- name: Check out from GitLab Portfolio Repo
uses: actions/checkout@v3
with:
repository: ${{ env.GITLAB_REPO_URL }}
token: ${{ secrets.ACTIONS_GITLAB_TOKEN }}
path: ${{ env.GITLAB_REPO_PATH }}
ref: 'main'
- name: Copy files to GitLab portfolio repo
run: |
cp -rf * ./GITLAB_REPO_PATH
- name: Commit and Push to GitHub Pages
run: |
# Exrtract Application Version
APP_VERSION=`cat package.json | jq -r '.version'`
echo "APP_VERSION: $APP_VERSION"
# Commit and Push
cd $GITLAB_REPO_PATH
git config user.name "GitHub Actions Bot"
git config user.email "${{ secrets.ACTIONS_GITLAB_EMAIL }}"
git switch -c "v$APP_VERSION"
git add .
git commit -m "Deploy $APP_VERSION"
git push origin "v$APP_VERSION"
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "portfolio-website-react",
"version": "1.7.3",
"version": "1.8.0",
"description": "Ada Cheng's Portfolio Web Site",
"author": "adafycheng",
"license": "MIT",
Expand Down

0 comments on commit bdfd4ec

Please sign in to comment.