-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #410 from nobkd/feat-action/web-publish
feat(action): site + example publish
- Loading branch information
Showing
3 changed files
with
108 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,70 @@ | ||
name: Push examples to web server | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
paths: | ||
- packages/examples/** | ||
|
||
jobs: | ||
examples: | ||
if: ${{ github.repository_owner == 'nuejs' }} | ||
|
||
strategy: | ||
matrix: | ||
dir: # dirs in "examples" to run build & push process for | ||
- simple-blog | ||
|
||
env: | ||
dir: 'packages/examples/${{ matrix.dir }}/' | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: # get entries to check for change in dir | ||
fetch-depth: 2 | ||
|
||
- name: Check dir changes | ||
run: git diff --name-only HEAD^ HEAD | grep -q "^${{ env.dir }}" | ||
|
||
# subsitutes non-alphanumeric characters with _ | ||
- name: Build secret variable names | ||
run: | | ||
mdir="${{ matrix.dir }}" | ||
name="${mdir//[^[:alnum:]]/_}" | ||
echo "$name" | ||
echo "storage_name=STORAGE_NAME_$name" >> $GITHUB_ENV | ||
echo "storage_pass=STORAGE_PASS_$name" >> $GITHUB_ENV | ||
echo "pull_id=PULL_ID_$name" >> $GITHUB_ENV | ||
# creates archive of dir, removes img dirs, moves content to subdir "source" | ||
- name: Create test archive | ||
run: tar -C "${{ env.dir }}" --exclude "*/img" --transform "s/^\.\//source\//" -cf "${{ env.dir }}test.tar.gz" . | ||
if: ${{ matrix.dir == 'simple-blog' }} | ||
|
||
# creates archive of dir, moves content to subdir "source" | ||
- name: Create source archive | ||
run: git archive --prefix "source/" -o "${{ env.dir }}source.tar.gz" "HEAD:${{ env.dir }}" | ||
|
||
# Copy source archive, to allow old source path on web server. Step should get removed after new release and a bit of time | ||
- name: Duplicate source archive | ||
run: cp "${{ env.dir }}source.tar.gz" "${{ env.dir }}${{ matrix.dir }}.tar.gz" | ||
|
||
- name: Nue build | ||
uses: ./.github/workflows/repo/build-page | ||
with: | ||
root: ${{ env.dir }} | ||
|
||
- name: BunnyCDN storage deployer | ||
uses: ayeressian/[email protected] | ||
with: | ||
source: '${{ env.dir }}.dist/prod' | ||
storageZoneName: '${{ secrets[env.storage_name] }}' | ||
storagePassword: '${{ secrets[env.storage_pass] }}' | ||
pullZoneId: '${{ secrets[env.pull_id] }}' | ||
accessKey: '${{ secrets.BUNNY_API_KEY }}' | ||
upload: 'true' | ||
remove: 'false' | ||
purgePullZone: 'true' |
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Push site to web server | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
paths: | ||
- packages/nuejs.org/** | ||
|
||
jobs: | ||
site: | ||
if: ${{ github.repository_owner == 'nuejs' }} | ||
|
||
env: | ||
dir: 'packages/nuejs.org/' | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Nue build | ||
uses: ./.github/workflows/repo/build-page | ||
with: | ||
root: ${{ env.dir }} | ||
|
||
- name: BunnyCDN storage deployer | ||
uses: ayeressian/[email protected] | ||
with: | ||
source: '${{ env.dir }}.dist/prod' | ||
storageZoneName: '${{ secrets.STORAGE_NAME_site }}' | ||
storagePassword: '${{ secrets.STORAGE_PASS_site }}' | ||
pullZoneId: '${{ secrets.PULL_ID_site }}' | ||
accessKey: '${{ secrets.BUNNY_API_KEY }}' | ||
upload: 'true' | ||
remove: 'false' | ||
purgePullZone: 'true' |
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