Skip to content

Commit

Permalink
CI: Migrate to Github Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
julianxhokaxhiu committed Jan 28, 2024
1 parent 1b420c7 commit 240a652
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 66 deletions.
59 changes: 0 additions & 59 deletions .ci/azure.yml

This file was deleted.

24 changes: 17 additions & 7 deletions .ci/build.ps1 → .github/workflows/build.ps1
Original file line number Diff line number Diff line change
@@ -1,29 +1,39 @@
Set-StrictMode -Version Latest

$env:_APP_VERSION = $env:_BUILD_VERSION.Substring(0,$env:_BUILD_VERSION.LastIndexOf('.'))
if ($env:_BUILD_BRANCH -eq "refs/heads/master" -Or $env:_BUILD_BRANCH -eq "refs/tags/canary") {
if ($env:_BUILD_BRANCH -eq "refs/heads/master" -Or $env:_BUILD_BRANCH -eq "refs/tags/canary")
{
$env:_IS_BUILD_CANARY = "true"
$env:_IS_GITHUB_RELEASE = "true"
}
elseif ($env:_BUILD_BRANCH -like "refs/tags/*") {
elseif ($env:_BUILD_BRANCH -like "refs/tags/*")
{
$env:_CHANGELOG_VERSION = $env:_BUILD_VERSION.Substring(0,$env:_BUILD_VERSION.LastIndexOf('.')).Replace('.','')
$env:_BUILD_VERSION = $env:_BUILD_VERSION.Substring(0,$env:_BUILD_VERSION.LastIndexOf('.')) + ".0"
$env:_IS_GITHUB_RELEASE = "true"
}
$env:_RELEASE_VERSION = "v${env:_BUILD_VERSION}"

Write-Output "--------------------------------------------------"
Write-Output "APP VERSION: $env:_APP_VERSION"
Write-Output "BUILD CONFIGURATION: $env:_RELEASE_CONFIGURATION"
Write-Output "RELEASE VERSION: $env:_RELEASE_VERSION"
Write-Output "--------------------------------------------------"

Write-Host "##vso[task.setvariable variable=_BUILD_VERSION;]${env:_BUILD_VERSION}"
Write-Host "##vso[task.setvariable variable=_RELEASE_VERSION;]${env:_RELEASE_VERSION}"
Write-Host "##vso[task.setvariable variable=_IS_BUILD_CANARY;]${env:_IS_BUILD_CANARY}"
Write-Output "_BUILD_VERSION=${env:_BUILD_VERSION}" >> ${env:GITHUB_ENV}
Write-Output "_RELEASE_VERSION=${env:_RELEASE_VERSION}" >> ${env:GITHUB_ENV}
Write-Output "_IS_BUILD_CANARY=${env:_IS_BUILD_CANARY}" >> ${env:GITHUB_ENV}
Write-Output "_IS_GITHUB_RELEASE=${env:_IS_GITHUB_RELEASE}" >> ${env:GITHUB_ENV}

# Start build
agvtool new-marketing-version $env:_APP_VERSION
xcodebuild -project "${env:_RELEASE_NAME}.xcodeproj" -scheme "${env:_RELEASE_NAME}" -configuration "${env:_RELEASE_CONFIGURATION}" -derivedDataPath ".dist"

# Install dependencies
npm install --global create-dmg
Copy-Item LICENSE .dist/Build/Products/$env:_RELEASE_CONFIGURATION/license.txt

# Create DMG
$ErrorActionPreference = 'SilentlyContinue'
Copy-Item LICENSE .dist/Build/Products/$env:_RELEASE_CONFIGURATION/license.txt
create-dmg .dist/Build/Products/$env:_RELEASE_CONFIGURATION/${env:_RELEASE_NAME}.app .dist/
Move-Item ".dist/${env:_RELEASE_NAME} ${env:_APP_VERSION}.dmg" .dist/${env:_RELEASE_NAME}.dmg
exit 0
69 changes: 69 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: iPoPS

run-name: 1.3.0.${{ github.run_number }}

on:
workflow_dispatch:
push:
branches:
- master
tags:
- "*"
pull_request:
branches:
- master

env:
_IS_BUILD_CANARY: false
_IS_GITHUB_RELEASE: false
_RELEASE_NAME: iPoPS
_RELEASE_VERSION: v0
_RELEASE_CONFIGURATION: Release
_BUILD_BRANCH: "${{ github.ref }}"
_BUILD_VERSION: "1.3.0.${{ github.run_number }}"
# GIT: Fix reporting from stderr to stdout
GIT_REDIRECT_STDERR: 2>&1

jobs:
iPoPS:
runs-on: macos-latest
timeout-minutes: 1440
strategy:
max-parallel: 1
steps:
- name: Checkout
uses: actions/[email protected]
- name: Build
run: ".github/workflows/build.ps1"
shell: pwsh
env:
GITHUB_PACKAGES_PAT: ${{ secrets.GITHUB_TOKEN }}
- name: Publish PR artifacts
if: env._IS_GITHUB_RELEASE == 'false' && success()
uses: actions/[email protected]
with:
name: "${{ env._RELEASE_NAME }}-${{ env._RELEASE_VERSION }}"
path: ".dist/*.dmg"
- name: Publish Canary release
uses: ncipollo/release-action@v1
if: env._IS_GITHUB_RELEASE == 'true' && env._IS_BUILD_CANARY == 'true' && success()
with:
artifacts: ".dist/*.dmg"
allowUpdates: true
generateReleaseNotes: true
prerelease: true
removeArtifacts: true
tag: canary
name: "${{ env._RELEASE_NAME }}-${{ env._RELEASE_VERSION }}"
body: |
This is a canary build. Please be aware it may be prone to crashing and is NOT tested by anyone.
The App is NOT signed. You need to allow it to run in your Gatekeeper settings panel. Use this build AT YOUR OWN RISK!
- name: Publish Stable release
uses: ncipollo/release-action@v1
if: env._IS_GITHUB_RELEASE == 'true' && env._IS_BUILD_CANARY == 'false' && success()
with:
artifacts: ".dist/*.dmg"
generateReleaseNotes: true
makeLatest: true
removeArtifacts: true
name: "${{ env._RELEASE_NAME }}-${{ env._RELEASE_VERSION }}"

0 comments on commit 240a652

Please sign in to comment.