From 9a6defaca8007d79ad57f5a556fd77196571c88b Mon Sep 17 00:00:00 2001 From: Gabriel Simmer Date: Sun, 10 Mar 2024 16:40:43 +0000 Subject: [PATCH] Basic CI --- .forgejo/workflows/publish-posts.yml | 33 ++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .forgejo/workflows/publish-posts.yml diff --git a/.forgejo/workflows/publish-posts.yml b/.forgejo/workflows/publish-posts.yml new file mode 100644 index 0000000..51c3c85 --- /dev/null +++ b/.forgejo/workflows/publish-posts.yml @@ -0,0 +1,33 @@ +name: Publish posts +on: + push: + paths: + - 'posts/**' + - '.forgejo/workflows/publish-posts.yml' + +jobs: + sync: + runs-on: debian-latest + steps: + - name: Checkout code + uses: actions/checkout@v3.5.3 + with: + ref: trunk + - name: Install AWS CLI + run: | + curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" + unzip awscliv2.zip + ./aws/install + - name: Sync with S3 + run: | + aws s3 sync ./posts s3://gabrielsimmer-com/posts --endpoint-url=$AWS_ENDPOINT --size-only --delete --output text + env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY_SECRET }} + AWS_DEFAULT_REGION: 'weur' + AWS_ENDPOINT: ${{ secrets.AWS_ENDPOINT }} + - name: Reindex posts + run: | + curl -H "Authorization: $GABRIELSIMMER_COM_KEY" https://gabrielsimmer.com/api/reindex + env: + GABRIELSIMMER_COM_KEY: ${{ secrets.GABRIELSIMMER_COM_KEY }}