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 e3434d0 commit 25630e0
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 64 deletions.
48 changes: 0 additions & 48 deletions .ci/azure.yml

This file was deleted.

16 changes: 0 additions & 16 deletions .ci/build.ps1

This file was deleted.

50 changes: 50 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: LineageOTA

on:
push:
branches:
- '2.0'
tags:
- "*"
pull_request:
branches:
- '2.0'

env:
_RELEASE_NAME: julianxhokaxhiu/lineageota
_RELEASE_VERSION: v0
_BUILD_VERSION: "2.9.0.${{ github.run_number }}"
_BUILD_BRANCH: "${{ github.ref }}"

jobs:
LineageOTA:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
- name: Prepare environment
run: ".github/workflows/prepare.ps1"
shell: pwsh
- name: Login to Docker Hub
uses: docker/[email protected]
with:
username: julianxhokaxhiu
password: "${{ secrets.DOCKERHUB_CI_DOCKER_PASSWORD }}"
- name: Build
uses: docker/build-push-action@v5
with:
tags: ${{ env._RELEASE_NAME }}:${{ env._RELEASE_VERSION }}
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: ${{ env._RELEASE_NAME }}:${{ env._RELEASE_VERSION }}
format: 'table'
exit-code: '1'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH,MEDIUM,LOW'
- name: Push
uses: docker/build-push-action@v5
with:
push: true
tags: ${{ env._RELEASE_NAME }}:${{ env._RELEASE_VERSION }}
17 changes: 17 additions & 0 deletions .github/workflows/prepare.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
if ($env:_BUILD_BRANCH -eq "refs/heads/2.0")
{
$env:_IS_BUILD_CI = "true"
$env:_RELEASE_VERSION = "latest"
}
elseif ($env:_BUILD_BRANCH -like "refs/tags/*")
{
$env:_RELEASE_VERSION = $env:_BUILD_VERSION.Substring(0,$env:_BUILD_VERSION.LastIndexOf('.'))
}

Write-Output "--------------------------------------------------"
Write-Output "CI: $env:_IS_BUILD_CI"
Write-Output "RELEASE NAME: $env:_RELEASE_NAME"
Write-Output "RELEASE VERSION: $env:_RELEASE_VERSION"
Write-Output "--------------------------------------------------"

Write-Output "_RELEASE_VERSION=${env:_RELEASE_VERSION}" >> ${env:GITHUB_ENV}

0 comments on commit 25630e0

Please sign in to comment.