Add crates-index workflows

This commit is contained in:
Folyd 2019-12-27 18:14:21 +08:00
parent a96ea8f203
commit 2d23703207
3 changed files with 23 additions and 6 deletions

17
.github/workflows/crates-index.yml vendored Normal file
View file

@ -0,0 +1,17 @@
name: Crates-index
on:
schedule:
- cron: "*/30 * * * *"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: |
git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/*
- name: Deloy crates index
run: ./scripts/deploy-crates-index.sh

View file

@ -14,9 +14,10 @@ build() {
upload() {
echo "Starting uploading crates-index..."
git checkout ${BRANCH}
git pull --rebase
git config --global url."https://".insteadOf git://
git config --global url."https://github.com/".insteadOf git@github.com:
git checkout ${BRANCH}
if [[ ! -d "crates" ]]
then
mkdir crates
@ -26,8 +27,8 @@ upload() {
git config user.name "GitHub Actions"
git config user.email "github-actions-bot@users.noreply.github.com"
git add crates/
git commit -m "Upload latest crates index"
git push origin $BRANCH
git commit --amend -m "Upload latest crates index"
git push "https://${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" ${BRANCH}:${BRANCH} -f
echo "Upload complete"
}

View file

@ -19,12 +19,11 @@ deploy() {
git config --global url."https://github.com/".insteadOf git@github.com:
git checkout ${BRANCH}
mv /tmp/public public/
rm -rf public/ && mv /tmp/public .
git config user.name "GitHub Actions"
git config user.email "github-actions-bot@users.noreply.github.com"
git add public/
git commit -m "Deploy new version to Github Pages"
git pull --rebase
git push "https://${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" ${BRANCH}:${BRANCH}
echo "Deploy complete"