From 66cbf800f5b5b68d327ab59ecc1241c74fa67278 Mon Sep 17 00:00:00 2001 From: Aleksandr Gornostal Date: Sun, 13 Nov 2022 11:26:00 +0200 Subject: [PATCH] Publish to cloudfront with github actions --- .github/workflows/publish.yaml | 39 ++++++++++++++++++++++++++++++++++ _config.yml | 2 +- _layouts/default.html | 3 +-- 3 files changed, 41 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/publish.yaml diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 0000000..64a3b23 --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,39 @@ +name: Publish to Cloudfront + +on: + push: + branches: [ master ] + +jobs: + publish: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.0' # Not needed with a .ruby-version file + bundler-cache: true # runs 'bundle install' and caches installed gems automatically + - name: Install dependencies + run: gem install json github-pages jekyll-github-metadata minitest + - name: Build + run: jekyll build + + - uses: actions/setup-python@v2 + with: + python-version: '3.10' + - name: Install AWS CLI + run: | + python -m pip install --upgrade pip + pip install awscli + - run: aws s3 sync _site s3://ulauncher.io --region us-east-1 --cache-control max-age=0 --acl public-read + env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + - name: Invalidate Cloudfront + run: aws cloudfront create-invalidation --distribution-id EUJKQR38BVSMX --paths "/*" + env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} diff --git a/_config.yml b/_config.yml index 11f639a..f00ea8f 100644 --- a/_config.yml +++ b/_config.yml @@ -1,3 +1,3 @@ name: ulauncher.io description: Ulauncher App -exclude: ['README.md', 'run-locally.sh', 'build.sh', 'LICENSE.txt', 'travis.yml'] +exclude: ['README.md', 'Dockerfile', 'jekyll', 'run-locally.sh', 'build.sh', 'LICENSE.txt', 'travis.yml'] diff --git a/_layouts/default.html b/_layouts/default.html index 268018a..fe3f2eb 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -46,12 +46,11 @@