generated from Websoft9/websoft9
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5c446a2
commit 87bd5ec
Showing
1 changed file
with
31 additions
and
23 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,43 @@ | ||
name: Mirror to Gitee Repo | ||
name: Build and Publish File Package | ||
|
||
# on: [ push, delete, create ] | ||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
git-mirror: | ||
build-and-publish: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Configure Private Key | ||
env: | ||
SSH_PRIVATE_KEY: ${{ secrets.GITEE_PRIVATE_KEY }} | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Build package | ||
run: | | ||
mkdir -p ~/.ssh | ||
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa | ||
chmod 600 ~/.ssh/id_rsa | ||
echo "StrictHostKeyChecking no" >> ~/.ssh/config | ||
- name: Push Mirror | ||
# Build your package here | ||
# For example, create a tar or zip file | ||
tar -czvf test.tar.gz ./tests | ||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
# SOURCE_REPO: 'https://github.com/mgithubTestOrg/giteeMirror.git' | ||
SOURCE_REPO: "https://github.com/${{ github.repository }}.git" | ||
# DESTINATION_REPO: 'git@gitee.com:mgithubTestOrg/giteeMirror.git' | ||
# DESTINATION_REPO: 'git@gitee.com:${{ github.repository }}.git' | ||
DESTINATION_REPO: "git@gitee.com:websoft9/${{ github.event.repository.name }}.git" | ||
BASE_REPO: "https://github.com/${{ github.repository }}" | ||
run: | | ||
git clone "$SOURCE_REPO" && cd `basename "$BASE_REPO"` | ||
git config --global user.name "${{ github.actor }}" | ||
git config --global user.email "xxx@websoft9.com" | ||
GITHUB_TOKEN: ${{ secrets.MYGITHUB_ADMIN_TOKEN }} | ||
with: | ||
tag_name: v1.0.0 | ||
release_name: Release v1.0.0 | ||
body: | | ||
Release v1.0.0 | ||
draft: false | ||
prerelease: false | ||
|
||
git remote set-url --push origin "$DESTINATION_REPO" | ||
git push origin main --force | ||
- name: Upload Package | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./build-package.tar.gz | ||
asset_name: build-package.tar.gz | ||
asset_content_type: application/gzip |