Skip to content

Commit

Permalink
minor changes (#11)
Browse files Browse the repository at this point in the history
* add workflow_dispatch

* replace all apt with apt-get

* fix typo

* use sudo -v

* remove some comments

these code are well self-explained
  • Loading branch information
chun-awa authored Jul 5, 2024
1 parent a83ffae commit 7e21da0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
branches: [ "main" ]
schedule:
- cron: "59 15 * * *"
workflow_dispatch:

defaults:
run:
Expand All @@ -22,19 +23,19 @@ jobs:

- name: Update Lingmo repo
run: |
apt-get update -y && apt-get upgrade -y && apt install -y apt-transport-https ca-certificates
apt-get update -y && apt-get upgrade -y && apt-get install -y apt-transport-https ca-certificates
echo "deb [trusted=yes] https://packages-lingmo.simplelinux.cn.eu.org/polaris polaris main contrib non-free" >> /etc/apt/sources.list.d/lingmo-rolling.list
apt update
apt-get update
- name: Update Apt and Install packages
run: |
apt-get update -y && apt-get upgrade -y
apt install -y sudo equivs curl git devscripts lintian build-essential automake autotools-dev cmake g++ --no-install-recommends
apt-get install -y sudo equivs curl git devscripts lintian build-essential automake autotools-dev cmake g++ --no-install-recommends
- name: Install PowerShell
run: |
curl -L https://github.com/PowerShell/PowerShell/releases/download/v7.4.3/powershell_7.4.3-1.deb_amd64.deb -o powershell.deb
sudo apt install -y ./powershell.deb
apt-get install -y ./powershell.deb
rm powershell.deb
- name: Build Lingmo
Expand Down
14 changes: 6 additions & 8 deletions Modules/BuildUtils.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ Import-Module "$PSScriptRoot/GitModule"
Import-Module "$PSScriptRoot/SourceRepoTools"

function Get-SudoPrivilege {
Write-Host "Now checking for sudo rights."
Write-Host "Please enter your password to get sudo right if needed."
Write-Host "Now checking for root privileges."
Write-Host "Please enter your password to get root privileges if needed."

$currentUser = (whoami).ToString()
if ($currentUser -ne "root") {
sudo sh -c "echo 1 >> /dev/null"
sudo -v
} else {
return $true
}
Expand Down Expand Up @@ -46,7 +46,6 @@ function Install-RepoDepends($repoPath) {
sudo mk-build-deps -i -t "apt-get -y" -r | Out-Null
}

# 定义一个函数来编译项目
function Start-CompileDeb($repo) {
Write-Host "Start to compile $($repo.repoName) ..."

Expand All @@ -61,14 +60,13 @@ function Start-CompileDeb($repo) {
Write-Host "$($repo.repoName) Complete!"

Write-Host "Copy $($repo.repoName) artifacts"

# 设置目录路径

$debPath = Get-SourceCodePath
# 检查目录是否存在,如果不存在则创建

if (-not (Test-Path (Get-ArtifactExportPath))) {
New-Item -ItemType Directory -Path (Get-ArtifactExportPath) | Out-Null
}
# 移动符合条件的文件

Get-ChildItem -Path $debPath -Filter '*.deb' | Move-Item -Force -Confirm:$false -Destination (Get-ArtifactExportPath)
}

Expand Down

0 comments on commit 7e21da0

Please sign in to comment.