Sync Element Web #29
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
| name: Sync Element Web | |
| on: | |
| schedule: | |
| - cron: "0 3 * * 1,4" # every Monday and Thursday at 03:00 UTC | |
| workflow_dispatch: | |
| jobs: | |
| sync: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: true | |
| - name: Get latest release info | |
| id: release | |
| run: | | |
| LATEST=$(curl -s https://api.github.com/repos/element-hq/element-web/releases/latest | jq -r '.tag_name') | |
| echo "tag=$LATEST" >> $GITHUB_OUTPUT | |
| echo "Latest release: $LATEST" | |
| # Check if this version is already processed | |
| if [ -f "current-release.txt" ]; then | |
| CURRENT=$(cat current-release.txt) | |
| if [ "$CURRENT" == "$LATEST" ]; then | |
| echo "skip=true" >> $GITHUB_OUTPUT | |
| echo "Release $LATEST already processed, skipping..." | |
| else | |
| echo "skip=false" >> $GITHUB_OUTPUT | |
| echo "New release detected: $CURRENT -> $LATEST" | |
| fi | |
| else | |
| echo "skip=false" >> $GITHUB_OUTPUT | |
| echo "No current-release.txt found, processing $LATEST" | |
| fi | |
| - name: Download release tarball | |
| if: steps.release.outputs.skip != 'true' | |
| run: | | |
| curl -L https://github.com/element-hq/element-web/releases/download/${{ steps.release.outputs.tag }}/element-${{ steps.release.outputs.tag }}.tar.gz \ | |
| -o element-web.tar.gz | |
| tar -xzf element-web.tar.gz | |
| mv element-${{ steps.release.outputs.tag }} upstream-release | |
| - name: Run rename/move script | |
| if: steps.release.outputs.skip != 'true' | |
| run: | | |
| chmod +x ./scripts/rename.sh | |
| mkdir -p ./processed | |
| ./scripts/rename.sh ./upstream-release ./processed | |
| - name: Commit and push | |
| if: steps.release.outputs.skip != 'true' | |
| run: | | |
| git config user.name "github-actions" | |
| git config user.email "[email protected]" | |
| # Clean up temporary files | |
| rm -rf upstream-release element-web.tar.gz | |
| # Save the current release version | |
| echo "${{ steps.release.outputs.tag }}" > current-release.txt | |
| # Only commit if there are changes | |
| if [ -n "$(git status --porcelain)" ]; then | |
| git add processed/ | |
| [ -f current-release.txt ] && git add current-release.txt | |
| git commit -m "Update to ${{ steps.release.outputs.tag }}" | |
| git push origin main | |
| else | |
| echo "No changes to commit" | |
| fi | |
| - name: Prepare changelog for issue | |
| if: steps.release.outputs.skip != 'true' | |
| run: | | |
| # Fetch release notes from GitHub API | |
| curl -s https://api.github.com/repos/element-hq/element-web/releases/tags/${{ steps.release.outputs.tag }} \ | |
| | jq -r '.body' > ./changelog-excerpt.md | |
| echo "Release notes fetched from GitHub" | |
| - name: Notify via GitHub issue | |
| if: steps.release.outputs.skip != 'true' | |
| uses: peter-evans/create-issue-from-file@v5 | |
| with: | |
| title: "New Element Web release ${{ steps.release.outputs.tag }}" | |
| content-filepath: ./changelog-excerpt.md | |
| token: ${{ secrets.GITHUB_TOKEN }} | |