create action archive cache.

This commit is contained in:
Tingluo Huang
2023-09-18 20:21:53 +00:00
parent 7751908620
commit 085299903d
6 changed files with 39 additions and 18 deletions

View File

@@ -6,8 +6,6 @@ on:
branches:
- main
pull_request: {}
schedule:
- cron: '0 0 * * 0'
jobs:
build:
@@ -25,14 +23,9 @@ jobs:
- name: Verify no unstaged changes
run: ./script/verify-no-unstaged-changes.sh
publish:
if: github.event_name != 'pull_request'
needs: [build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build
run: |
./script/build.sh
echo ${{ github.sha }} > ./_layout/SHA1
- name: Release
if: github.event_name == 'workflow_dispatch'
run: |
gh release create v${{github.sha}} --generate-notes ./_layout/action_cache.zip ./_layout/action_cache.tar.gz
env:
GH_TOKEN: ${{ github.token }}

2
.gitignore vendored
View File

@@ -1,2 +1,4 @@
_layout
_layout_zipball
_layout_tarball
_temp

View File

@@ -6,7 +6,7 @@
"+^v[0-9]+(\\.[0-9]+){0,2}$"
],
"branches": {
"main": "883490dfd06f396ebe0b738bc313a53cf9d851e5"
"main": "bfd2fb341f32be7281829126376a12a780ca79fc"
},
"defaultBranch": "main",
"tags": {

View File

@@ -85,8 +85,34 @@ done
popd
# List the repositories
cd $layout_dir
pushd "$layout_dir"
echo 'Created repos:'
for repo in ./*; do
echo "$PWD/$repo"
done
popd
# Split the layout into zip vs. tar.gz
zipball_layout_dir="$script_dir/../_layout_zipball"
rm -rf "$zipball_layout_dir"
tarball_layout_dir="$script_dir/../_layout_tarball"
rm -rf "$tarball_layout_dir"
cp -r "$layout_dir" "$zipball_layout_dir"
pushd "$zipball_layout_dir"
find . -type f -name "*.tar.gz" -delete
ls -l -R ./
echo "Creating action_cache_zipball in ${zipball_layout_dir}"
pwsh -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command "Compress-Archive -Path \"${zipball_layout_dir}\" -DestinationPath \"${layout_dir}\action_cache.zip\""
popd
cp -r "$layout_dir" "$tarball_layout_dir"
pushd "$tarball_layout_dir"
find . -type f -name "*.zip" -delete
ls -l -R ./
echo "Creating action_cache.tar.gz in ${tarball_layout_dir}"
pushd "$layout_dir"
tar -czf "action_cache.tar.gz" -C "${tarball_layout_dir}" .
popd
popd

View File

@@ -23,7 +23,7 @@ git push --set-upstream origin "$branch"
# Open pull request
url="https://api.github.com/repos/$GITHUB_REPOSITORY/pulls" # GITHUB_REPOSITORY format is: OWNER/REPO
body="{\"title\": \"$branch\", \"body\": \"$branch\", \"head\": \"$branch\", \"base\": \"master\"}"
body="{\"title\": \"$branch\", \"body\": \"$branch\", \"head\": \"$branch\", \"base\": \"main\"}"
http_code="$(curl --silent --output response.json --write-out '%{http_code}' --header "Authorization: bearer $GITHUB_TOKEN" --request POST --data "$body" "$url")"
if [[ "$http_code" != "201" ]]; then
echo "Unexpected HTTP CODE '$http_code'"

View File

@@ -1,7 +1,7 @@
mkdir actions_setup-go
pushd actions_setup-go
curl -s -S -L -o '883490dfd06f396ebe0b738bc313a53cf9d851e5.tar.gz' 'https://api.github.com/repos/actions/setup-go/tarball/883490dfd06f396ebe0b738bc313a53cf9d851e5'
curl -s -S -L -o '883490dfd06f396ebe0b738bc313a53cf9d851e5.zip' 'https://api.github.com/repos/actions/setup-go/zipball/883490dfd06f396ebe0b738bc313a53cf9d851e5'
curl -s -S -L -o 'bfd2fb341f32be7281829126376a12a780ca79fc.tar.gz' 'https://api.github.com/repos/actions/setup-go/tarball/bfd2fb341f32be7281829126376a12a780ca79fc'
curl -s -S -L -o 'bfd2fb341f32be7281829126376a12a780ca79fc.zip' 'https://api.github.com/repos/actions/setup-go/zipball/bfd2fb341f32be7281829126376a12a780ca79fc'
curl -s -S -L -o '77b162d042858409656f087cab0246511e670694.tar.gz' 'https://api.github.com/repos/actions/setup-go/tarball/77b162d042858409656f087cab0246511e670694'
curl -s -S -L -o '77b162d042858409656f087cab0246511e670694.zip' 'https://api.github.com/repos/actions/setup-go/zipball/77b162d042858409656f087cab0246511e670694'
curl -s -S -L -o '58fca98f91e83c6442c09dc7175251c60ee9877c.tar.gz' 'https://api.github.com/repos/actions/setup-go/tarball/58fca98f91e83c6442c09dc7175251c60ee9877c'