This repository has been archived by the owner on Jun 21, 2024. It is now read-only.
update_v2raya #292
This file contains 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: update_v2raya | |
on: | |
# Check once a day | |
schedule: | |
- cron: "0 0 * * *" | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
update: | |
runs-on: ubuntu-latest | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.PERSONAL_ACCESS_TOKEN_EXPIRATION_20240911 }} | |
- id: v2raya | |
uses: pozetroninc/github-action-get-latest-release@master | |
with: | |
repository: v2rayA/v2rayA | |
- id: v2raya_flatpak | |
uses: pozetroninc/github-action-get-latest-release@master | |
with: | |
repository: glaumar/v2raya-flatpak | |
- name: update version | |
if: steps.v2raya.outputs.release != steps.v2raya_flatpak.outputs.release | |
run: | | |
grep "<release .*${{ steps.v2raya.outputs.release }}\" />" io.github.glaumar.v2raya_flatpak.metainfo.xml && exit 1 | |
sed -i "{s/${{ steps.v2raya_flatpak.outputs.release }}.tar.gz/${{ steps.v2raya.outputs.release }}.tar.gz/g}" v2raya.yml | |
NEW_URL=$(grep -Po "(https://.*${{ steps.v2raya.outputs.release }}.tar.gz)$" v2raya.yml) | |
SHA256SUM=$(curl -sL ${NEW_URL} | sha256sum | cut -d ' ' -f1) | |
[ "${SHA256SUM}" = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" ] && exit 1 | |
sed -r -i "s/sha256: .*$/sha256: ${SHA256SUM}/g" v2raya.yml | |
sed -i "/<releases>/a\ \ \ \ <release date=\"$(date +%Y-%m-%d)\" version=\"${{ steps.v2raya.outputs.release }}\" />" io.github.glaumar.v2raya_flatpak.metainfo.xml | |
- name: Push and Create new tag | |
if: steps.v2raya.outputs.release != steps.v2raya_flatpak.outputs.release | |
uses: EndBug/add-and-commit@v9 | |
with: | |
add: | | |
io.github.glaumar.v2raya_flatpak.metainfo.xml | |
v2raya.yml | |
message: 'Update to ${{ steps.v2raya.outputs.release }} (from GitHub Actions update_v2raya)' | |
tag: ${{ steps.v2raya.outputs.release }} | |
push: true |