Skip to content

Commit

Permalink
fix: use deployer action
Browse files Browse the repository at this point in the history
  • Loading branch information
nobkd committed Dec 14, 2024
1 parent 41289b7 commit 13f2614
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 34 deletions.
24 changes: 11 additions & 13 deletions .github/workflows/push-examples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ jobs:

env:
dir: 'packages/examples/${{ matrix.dir }}/'
domain: '${{ matrix.dir }}.${{ vars.DOMAIN }}'
archive: 'site.tar.gz'
storage_name_key: 'STORAGE_NAME_${{ matrix.dir }}'
storage_password_key: 'STORAGE_PASSWORD_${{ matrix.dir }}'

runs-on: ubuntu-latest

Expand All @@ -43,7 +44,7 @@ jobs:
# 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"
Expand All @@ -52,16 +53,13 @@ jobs:
uses: ./.github/workflows/repo/build-page
with:
root: ${{ env.dir }}
archive: ${{ env.archive }}

- name: Prepare SSH
uses: kielabokkie/ssh-key-and-known-hosts-action@v1
- name: BunnyCDN storage deployer
uses: ayeressian/bunnycdn-storage-deploy@v2.2.4
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
ssh-host: ${{ secrets.SSH_HOST }}

# copies built site archive to server, unpacks archive on server
- name: Push files to web server
run: |
scp "${{ env.archive }}" "${{ env.domain }}@${{ secrets.SSH_HOST }}"
ssh "${{ env.domain }}@${{ secrets.SSH_HOST }}" "tar -xf ${{ env.archive }}"
source: '${{ env.dir }}.dist/prod'
storageZoneName: '${{ secrets[env.storage_name_key] }}'
storagePassword: '${{ secrets[env.storage_password_key] }}'
upload: 'true'
remove: 'false'
purgePullZone: 'false'
20 changes: 8 additions & 12 deletions .github/workflows/push-site.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ jobs:

env:
dir: 'packages/nuejs.org/'
domain: '${{ vars.DOMAIN }}'
archive: 'site.tar.gz'

runs-on: ubuntu-latest
Expand All @@ -29,16 +28,13 @@ jobs:
uses: ./.github/workflows/repo/build-page
with:
root: ${{ env.dir }}
archive: ${{ env.archive }}

- name: Prepare SSH
uses: kielabokkie/ssh-key-and-known-hosts-action@v1
- name: BunnyCDN storage deployer
uses: ayeressian/bunnycdn-storage-deploy@v2.2.4
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
ssh-host: ${{ secrets.SSH_HOST }}

# copies built site archive to server, unpacks archive on server
- name: Push files to web server
run: |
scp "${{ env.archive }}" "${{ env.domain }}@${{ secrets.SSH_HOST }}"
ssh "${{ env.domain }}@${{ secrets.SSH_HOST }}" "tar -xf ${{ env.archive }}"
source: '${{ env.dir }}.dist/prod'
storageZoneName: '${{ secrets.STORAGE_NAME_site }}'
storagePassword: '${{ secrets.STORAGE_PASSWORD_site }}'
upload: 'true'
remove: 'false'
purgePullZone: 'false'
9 changes: 0 additions & 9 deletions .github/workflows/repo/build-page/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ inputs:
root:
default: '.'
type: string
archive:
default: ''
type: string

runs:
using: composite
Expand All @@ -23,9 +20,3 @@ runs:
- name: Build Nue Project
shell: bash
run: nue build -pr "${{ inputs.root }}"

# archive generated site, remove leading "./" from file paths in archive
- name: Archive files
if: ${{ inputs.archive }}
shell: bash
run: tar -C "${{ inputs.root }}.dist/prod" --transform "s/^\.\///" -czf "${{ inputs.archive }}" .

0 comments on commit 13f2614

Please sign in to comment.