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

159 lines
5.4 KiB
YAML
Raw Permalink 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-06-20 14:52:40 +03:00
run: pacman -Syy -q --noconfirm && pacman -S -q --noconfirm git jq nix python python-requests openssl gcc-libs glibc
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-11-24 14:38:30 +03:00
release_name="v$VERSION"
2024-03-11 17:48:13 +03:00
tag_name="v$VERSION"
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
echo "release_name=$release_name" >> $GITHUB_OUTPUT
echo "tag_name=$tag_name" >> $GITHUB_OUTPUT
2024-05-07 07:33:07 +03:00
- name: Tag Repo
uses: rickstaa/action-create-tag@v1
with:
2024-05-07 07:35:07 +03:00
tag: ${{ steps.version.outputs.tag_name }}
2024-05-07 07:33:07 +03:00
force_push_tag: true
commit_sha: ${{ steps.commit.outputs.commit_long_sha || github.event.head_commit.id}}
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-14 14:22:37 +03:00
commited: ${{ steps.outputs.outputs.commited != '' }}
commit_long_sha: ${{ steps.outputs.outputs.commit_long_sha }}
commit_name: ${{ steps.outputs.outputs.commit_name }}
tag_name: ${{ steps.outputs.outputs.tag_name }}
release_name: ${{ steps.outputs.outputs.release_name }}
version: ${{ steps.outputs.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-14 14:22:37 +03:00
if: ${{ needs.update_packages.outputs.commited && github.ref_name == 'master' }}
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-07-04 08:40:06 +03:00
uses: KSXGitHub/github-actions-deploy-aur@v2.7.2
2024-02-05 16:18:51 +03:00
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-07-04 08:40:06 +03:00
ssh_keyscan_types: "rsa,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-10-17 11:05:06 +03:00
- name: Copy files to APT server
uses: appleboy/scp-action@v0.1.7
with:
host: ${{ secrets.CLOUD_SSH_HOST }}
username: ${{ secrets.CLOUD_SSH_USERNAME }}
password: ${{ secrets.CLOUD_SSH_PASSWORD }}
source: "dist/*.deb"
target: ~/apt/repo/deb-packages
rm: true
strip_components: 1
- name: Update APT repo
uses: appleboy/ssh-action@v1.1.0
with:
host: ${{ secrets.CLOUD_SSH_HOST }}
username: ${{ secrets.CLOUD_SSH_USERNAME }}
password: ${{ secrets.CLOUD_SSH_PASSWORD }}
2024-10-19 19:33:13 +03:00
script: ~/apt/update-repo.sh
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-05-07 07:33:07 +03:00
2024-02-03 12:15:40 +03:00
- 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 }}