0
0
mirror of https://github.com/cucumber-sp/yandex-music-linux.git synced 2024-12-23 22:22:59 +03:00
yandex-music-linux/.github/workflows/update-build-release.yml

140 lines
4.6 KiB
YAML
Raw Normal View History

2024-02-03 12:15:40 +03:00
name: Update, build and release
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
push:
branches:
- 'master'
2024-03-11 18:06:19 +03:00
- 'dev'
2024-02-03 12:15:40 +03:00
jobs:
update_packages:
runs-on: ubuntu-latest
container:
image: archlinux:latest
steps:
2024-03-11 17:48:13 +03:00
- name: Install dependencies
2024-03-11 18:15:09 +03:00
run: pacman -Syy -q --noconfirm && pacman -S -q --noconfirm git jq nix python python-requests
2024-02-03 12:15:40 +03:00
- name: Checkout
uses: actions/checkout@v4
2024-03-11 17:48:13 +03:00
- name: Git Access Fix
run: git config --global --add safe.directory "*"
2024-02-03 12:15:40 +03:00
- name: Update package files
2024-03-11 18:06:19 +03:00
run: |
python utility/update_version.py
2024-03-11 17:48:13 +03:00
python utility/generate_packages.py
2024-02-03 12:15:40 +03:00
- name: Commit and push changes
uses: EndBug/add-and-commit@v9.1.4
2024-03-11 17:48:13 +03:00
id: commit
2024-02-03 12:15:40 +03:00
with:
2024-03-11 17:48:13 +03:00
message: Update packages
2024-02-03 12:15:40 +03:00
add: "."
2024-03-11 17:48:13 +03:00
author_name: GitHub Actions
author_email: loraner123@gmail.com"
- name: Get Version
id: version
2024-03-11 18:06:19 +03:00
run: |
VERSION=$(jq -r '.ym.version' ./utility/version_info.json)
2024-03-11 17:48:13 +03:00
release_name="Beta $VERSION"
tag_name="v$VERSION"
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
echo "release_name=$release_name" >> $GITHUB_OUTPUT
echo "tag_name=$tag_name" >> $GITHUB_OUTPUT
2024-03-11 18:06:19 +03:00
- name: Outputs
id: outputs
run: |
echo "commited=${{ steps.commit.outputs.commited || github.event.head_commit }}" >> $GITHUB_OUTPUT
echo "commit_long_sha=${{ steps.commit.outputs.commit_long_sha || github.event.head_commit.id}}" >> $GITHUB_OUTPUT
echo "commit_name=${{ github.event.head_commit.message || 'Update packages' }}" >> $GITHUB_OUTPUT
echo "tag_name=${{ steps.version.outputs.tag_name }}" >> $GITHUB_OUTPUT
echo "release_name=${{ steps.version.outputs.release_name }}" >> $GITHUB_OUTPUT
echo "VERSION=${{ steps.version.outputs.VERSION }}" >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT
2024-03-11 17:48:13 +03:00
outputs:
2024-03-11 18:06:19 +03:00
commited: ${{ steps.outputs.commited != '' }}
commit_long_sha: ${{ steps.outputs.commit_long_sha }}
commit_name: ${{ steps.outputs.commit_name }}
tag_name: ${{ steps.outputs.tag_name }}
release_name: ${{ steps.outputs.release_name }}
version: ${{ steps.outputs.VERSION }}
2024-03-11 17:48:13 +03:00
build:
needs: [update_packages]
uses: ./.github/workflows/build.yml
if: ${{ needs.update_packages.outputs.commited }}
with:
ref: ${{ needs.update_packages.outputs.commit_long_sha }}
upload-release:
needs: [build, update_packages]
2024-03-11 18:15:09 +03:00
if: ${{ needs.update_packages.outputs.commited && github.ref_name == 'main' }}
2024-03-11 17:48:13 +03:00
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ needs.update_packages.outputs.commit_long_sha }}
- name: Publish package changes to AUR
2024-02-05 16:18:51 +03:00
uses: KSXGitHub/github-actions-deploy-aur@v2.7.0
with:
2024-02-14 14:07:10 +03:00
pkgname: "yandex-music"
2024-02-05 16:18:51 +03:00
pkgbuild: "PKGBUILD"
updpkgsums: false
2024-02-18 19:03:14 +03:00
allow_empty_commits: true
2024-02-05 16:18:51 +03:00
commit_username: "cucumber-sp"
commit_email: "loraner123@gmail.com"
ssh_private_key: "${{ secrets.AUR_SSH_PRIVATE_KEY }}"
2024-03-11 17:48:13 +03:00
commit_message: "${{ needs.update_packages.outputs.commit_name }}"
2024-02-05 16:18:51 +03:00
ssh_keyscan_types: "rsa,dsa,ecdsa,ed25519"
2024-02-03 12:15:40 +03:00
2024-03-11 17:48:13 +03:00
- name: Download artifact
uses: actions/download-artifact@v4
2024-02-03 12:15:40 +03:00
with:
merge-multiple: true
path: dist
2024-03-11 17:48:13 +03:00
- name: Install packages
2024-03-11 18:06:19 +03:00
run: |
sudo apt-get update -y
2024-03-11 17:48:13 +03:00
sudo apt-get install jq -y
2024-02-09 17:35:17 +03:00
- name: Get Release Notes HTML
2024-03-11 17:48:13 +03:00
id: release_notes
run: echo "release_html=$(jq -r --arg version "${{ needs.update_packages.outputs.version }}" '.["desktop-release-notes." + $version]' ./dist/release_notes.json)" >> $GITHUB_OUTPUT
2024-02-09 17:35:17 +03:00
2024-03-11 17:48:13 +03:00
- run: rm -rf dist/release_notes.json
2024-02-03 12:15:40 +03:00
- name: Tag Repo
uses: richardsimko/update-tag@v1
with:
2024-03-11 17:48:13 +03:00
tag_name: ${{ needs.update_packages.outputs.tag_name}}
2024-02-03 12:15:40 +03:00
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload files to a GitHub release
uses: ncipollo/release-action@v1.13.0
with:
allowUpdates: true
artifacts: dist/*
makeLatest: true
2024-03-11 17:48:13 +03:00
name: ${{ needs.update_packages.outputs.release_name }}
2024-02-03 12:15:40 +03:00
replacesArtifacts: true
2024-03-11 17:48:13 +03:00
tag: ${{ needs.update_packages.outputs.tag_name }}
body: ${{ steps.release_notes.outputs.release_html }}