diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 316adb9..1f39a9b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 @@ -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" diff --git a/package-lock.json b/package-lock.json index 96bab78..99a4292 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "portfolio-website-react", - "version": "1.7.3", + "version": "1.8.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "portfolio-website-react", - "version": "1.7.3", + "version": "1.8.0", "license": "MIT", "dependencies": { "@testing-library/jest-dom": "^5.16.5", diff --git a/package.json b/package.json index 9a86ecc..afd0853 100644 --- a/package.json +++ b/package.json @@ -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",