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

Update CI

This commit is contained in:
Maxim Slipenko 2024-02-03 12:15:40 +03:00
parent f1211f9aa7
commit e0e5e1ca86
5 changed files with 100 additions and 80 deletions

View File

@ -27,7 +27,6 @@ case $OS in
setfacl -m u::rwx,g::rwx /home/build
setfacl -d --set u::rwx,g::rwx,o::- /home/build
chown nobody .
sh ./generate_packages.sh
sudo -u nobody makepkg --log
mkdir dist
@ -40,7 +39,6 @@ case $OS in
;;
"Ubuntu")
echo NixOS
sh ./generate_packages.sh
export NIXPKGS_ALLOW_UNFREE=1
nix build --impure
;;

View File

@ -1,26 +1,27 @@
name: Build
on:
workflow_call:
inputs:
ref:
default: ''
required: false
type: string
pull_request:
branches:
- '*'
push:
branches:
- 'master'
jobs:
build:
strategy:
matrix:
container:
- archlinux:latest
runs-on: ubuntu-latest
container:
image: ${{ matrix.container }}
image: archlinux:latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ (inputs.ref || '') }}
- name: Build
run: sh ./.github/workflows/build.sh
@ -50,6 +51,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ (inputs.ref || '') }}
- name: Install nix
uses: cachix/install-nix-action@v22
@ -62,31 +65,4 @@ jobs:
with:
path: ./result/*
name: nix-package
upload-release:
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
needs: [build, nix-build]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download artifact
uses: actions/download-artifact@v4
with:
merge-multiple: true
path: dist
- name: Retrieve version
run: sh ./.github/workflows/retrieve_version.sh
- name: Upload files to a GitHub release
uses: ncipollo/release-action@v1.13.0
with:
allowUpdates: true
artifacts: dist/*
makeLatest: true
name: ${{ env.release_name }}
replacesArtifacts: true
tag: ${{ env.tag_name }}

View File

@ -1,9 +1,5 @@
#!/bin/bash
# install jq
sudo apt-get update
sudo apt-get install jq
# get version
VERSION=$(jq -r '.version' version_info.json)
release_name="Beta $VERSION"

View File

@ -0,0 +1,89 @@
name: Update, build and release
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
push:
branches:
- 'master'
jobs:
update_packages:
runs-on: ubuntu-latest
container:
image: archlinux:latest
steps:
- name: Pacman database update
run: pacman -Syy --noconfirm
- name: Install deps
run: pacman -S --noconfirm git jq
- name: Checkout
uses: actions/checkout@v4
- name: Check and update current packages
run: sh .github/workflows/update_packages.sh
- name: Retrieve version
run: sh .github/workflows/retrieve_version.sh
- name: Commit and push changes
uses: EndBug/add-and-commit@v9.1.4
id: commit
with:
message: "Update packages to ${{ env.release_name }}"
add: "."
author_name: "GitHub Actions"
author_email: "loraner123@gmail.com"
outputs:
new_version: ${{ steps.commit.outputs.commited }}
commit_long_sha: ${{ steps.commit.outputs.commit_long_sha }}
build:
if: ${{ (github.event_name == 'push') || (needs.update_packages.new_version) }}
needs: update_packages
uses: ./.github/workflows/build.yml
with:
ref: ${{ (needs.update_packages.commit_long_sha || '') }}
upload-release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ (needs.build.needs.update_packages.commit_long_sha || '') }}
- name: Download artifact
uses: actions/download-artifact@v4
with:
merge-multiple: true
path: dist
- name: Retrieve version
run: |
sudo apt-get update
sudo apt-get install jq
sh ./.github/workflows/retrieve_version.sh
- name: Tag Repo
uses: richardsimko/update-tag@v1
with:
tag_name: ${{ env.tag_name }}
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
name: ${{ env.release_name }}
replacesArtifacts: true
tag: ${{ env.tag_name }}

View File

@ -1,39 +0,0 @@
name: Update packages
# Controls when the action will run. Workflow runs when manually triggered using the UI
# or API.
on: workflow_dispatch
jobs:
update_packages:
strategy:
matrix:
container:
- archlinux:latest
runs-on: ubuntu-latest
container:
image: ${{ matrix.container }}
steps:
- name: Pacman database update
run: pacman -Syy --noconfirm
- name: Fix Git
run: pacman -S --noconfirm git
- name: Checkout
uses: actions/checkout@v4
- name: Check and update current packages
run: sh .github/workflows/update_packages.sh
- name: Save tag name
run: echo "TAG_NAME=v$(jq -r .version ./version_info.json)" >> $GITHUB_ENV
- name: Save version name (Beta x.x.x)
run: echo "VERSION_NAME=Beta $(jq -r .version ./version_info.json)" >> $GITHUB_ENV
- name: Commit and push changes
uses: EndBug/add-and-commit@v9.1.4
with:
message: "Update packages to ${{ env.VERSION_NAME }}"
add: "."
author_name: "GitHub Actions"
author_email: "loraner123@gmail.com"
tag: ${{ env.TAG_NAME }}
tag_push: '--force'