Update v2rayA snap #991
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 snap | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '30 */4 * * *' | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: main | |
- name: Install build dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y jq wget git python3-yaml | |
sudo snap install multipass | |
sudo snap install --classic --channel=8.x/stable snapcraft | |
python3 -m pip install yq==3.2.3 | |
- name: Get Current Version | |
run: | | |
CURRENT_VERSION=$(yq -r '.version' snap/snapcraft.yaml) | |
echo "CURRENT_VERSION=$CURRENT_VERSION" >> $GITHUB_ENV | |
- name: Export latest v2rayA version | |
run: | | |
NEW_VERSION=$(curl -s https://api.github.com/repos/v2rayA/v2rayA/releases/latest | jq -r '.tag_name | sub("^v"; "")') | |
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV | |
- name: Build .snap files | |
if: ${{ env.CURRENT_VERSION != env.NEW_VERSION }} | |
run: bash -x snap.sh ${NEW_VERSION} | |
- name: Release the snap to Snapcraft | |
if: ${{ env.CURRENT_VERSION != env.NEW_VERSION }} | |
env: | |
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }} | |
run: | | |
snapcraft push --release beta,stable ./v2raya_${NEW_VERSION}_x64.snap | |
snapcraft push --release beta,stable ./v2raya_${NEW_VERSION}_arm64.snap | |
snapcraft push --release beta,stable ./v2raya_${NEW_VERSION}_riscv64.snap | |
- uses: EndBug/add-and-commit@v9 | |
with: | |
add: 'snap/snapcraft.yaml' | |
fetch: true | |
message: 'GitHub Actions: Automatically update snapcraft.yaml to the latest version' | |
pathspec_error_handling: ignore | |
push: true |