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 }}