-
Notifications
You must be signed in to change notification settings - Fork 14
add action to deploy assets from PR and delete them when the PR is closed #159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
ec54e00
add action to deploy assets from PR and delete them when the PR is cl…
deniak ad3115c
use cdn.w3.org
deniak dd3a5dd
better use cdn-dev.w3.org for security reasons
deniak ea81939
use a different destination folder for PR
deniak c657341
use a different destination folder for PR
deniak 99d4058
rename action
deniak 8e9af62
run workflow only on pull_request
deniak File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,36 @@ | ||
on: | ||
pull_request_target: | ||
types: [opened, edited, reopened, synchronize] | ||
|
||
jobs: | ||
build_css: | ||
runs-on: ubuntu-latest | ||
env: | ||
source: public/dist/assets | ||
destination: assets/website-2021-dev/pr-${{ github.event.number }}/ | ||
deniak marked this conversation as resolved.
Show resolved
Hide resolved
|
||
steps: | ||
- name: Checkout source Git branch | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: ${{github.event.pull_request.head.ref}} | ||
persist-credentials: false | ||
|
||
- name: Use Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '16' | ||
|
||
- name: Install npm modules | ||
run: npm install | ||
|
||
- name: compile assets | ||
run: npm run build | ||
|
||
- name: Upload to cdn-dev.w3.org bucket | ||
if: success() | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
AWS_REGION: 'us-east-1' | ||
run: | ||
aws s3 sync --no-progress ${{ env.source }} s3://cdn-dev.w3.org/${{ env.destination }} | ||
jean-gui marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or 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,19 @@ | ||
on: | ||
pull_request_target: | ||
types: | ||
- closed | ||
|
||
jobs: | ||
delete_assets: | ||
runs-on: ubuntu-latest | ||
env: | ||
destination: assets/website-2021-dev/pr-${{ github.event.number }}/ | ||
steps: | ||
- name: Delete PR assets from the cdn-dev.w3.org bucket | ||
if: success() | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
AWS_REGION: 'us-east-1' | ||
run: | ||
aws s3 rm --recursive s3://cdn-dev.w3.org/${{ env.destination }} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.