From ad053800e83176e0c6f046f8db7c3c8e0b657431 Mon Sep 17 00:00:00 2001 From: blckmn Date: Tue, 14 Jun 2022 16:41:58 +1000 Subject: [PATCH] Moving to github actions, to attach on release. --- .github/workflows/build-release.yml | 39 ++++++++++++++ .github/workflows/ci.yml | 38 +++++++++++++ .github/workflows/pr.yml | 12 +++++ azure-pipelines.yml | 82 ----------------------------- 4 files changed, 89 insertions(+), 82 deletions(-) create mode 100644 .github/workflows/build-release.yml create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/pr.yml delete mode 100644 azure-pipelines.yml diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml new file mode 100644 index 0000000..a0a2c22 --- /dev/null +++ b/.github/workflows/build-release.yml @@ -0,0 +1,39 @@ +name: Release + +on: + release: + types: [published] + +jobs: + ci: + name: CI + uses: ./.github/workflows/ci.yml + with: + release_build: true + + release: + name: Release + needs: ci + runs-on: ubuntu-20.04 + steps: + - name: Code Checkout + uses: actions/checkout@v2 + + - name: Fetch build artifacts + uses: actions/download-artifact@v2 + + - name: List assets + run: ls -al Assets + + - name: Attach assets to release + run: | + set -x + assets=() + for asset in Assets/*.zip; do + assets+=("-a" "$asset") + echo "$asset" + done + tag_name="${GITHUB_REF##*/}" + hub release edit "${assets[@]}" -m "" "$tag_name" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..2c177ff --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,38 @@ +# Builds Betaflight Lua Scripts. +# +# After building, artifacts are kept for 7 days. + +name: CI + +on: + workflow_call: + inputs: + release_build: + description: 'Specifies if it is a debug build or a release build' + default: false + required: false + type: boolean + +jobs: + build: + name: Build + runs-on: ubuntu-20.04 + steps: + - name: Code Checkout + uses: actions/checkout@v2 + + - name: Install Lua + run: sudo apt-get -y install lua5.2 + + - name: Install Zip + run: sudo apt-get -y install zip + + - name: Execute Build + run: make release + + - name: Publish build artifacts + uses: actions/upload-artifact@v3 + with: + name: Assets + path: ./release/*.zip + retention-days: 7 diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 0000000..c207e7e --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,12 @@ +name: PR + +on: + pull_request: + branches: + - master + - '*-maintenance' + +jobs: + ci: + name: CI + uses: ./.github/workflows/ci.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index 837910b..0000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,82 +0,0 @@ -# Builds the Betaflight TX lua scripts. -# -# After building, artifacts are released to a seperate repository. -# -# Azure Pipelines requires the following extensions to be installed: -# - GitHub Tool: https://marketplace.visualstudio.com/items?itemName=marcelo-formentao.github-tools -# -# You'll also need to setup the follwing pipeline variables: -# "releaseNotes" - This is used to add the release notes in the windows job in the build stage so they can be published as part of the github release in the release stage -# "endpoint" - The name of the github endpoint link setup in AzDo - setup when linking AzDo and GitHub -# "owner" - The owner of the repository to release to e.g. betaflight -# "repoName" - The name of the repository to release to e.g. betaflight-configurator-nightly - -variables: - owner: betaflight - repoName: betaflight-tx-lua-scripts-nightlies - releaseNotes: This is a nightly build off the tip of 'master'. It may be unstable and result in corrupted configurations or data loss. **Use only for testing.** - vmImage: 'ubuntu-20.04' - -name: $(Date:yyyyMMdd).$(BuildID) - -trigger: - batch: true - branches: - include: - - master - -pr: - drafts: false - branches: - include: - - master - - "*-maintenance" - -stages: -- stage: Build - jobs: - - job: 'Linux' - pool: - vmImage: '$(vmImage)' - steps: - - script: sudo apt-get -y install lua5.2 - displayName: 'Install lua compiler.' - - script: make release -C $(System.DefaultWorkingDirectory) - displayName: 'Test and build the release.' - - task: PublishPipelineArtifact@1 - displayName: 'Publish release' - inputs: - artifactName: betaflight-tx-lua-scripts - targetPath: '$(System.DefaultWorkingDirectory)/release' - -- stage: Release - jobs: - - job: Release - pool: - vmImage: '$(vmImage)' - steps: - - task: DownloadPipelineArtifact@2 - inputs: - buildType: 'current' - targetPath: '$(Pipeline.Workspace)' - - task: GitHubReleasePublish@1 - inputs: - githubEndpoint: '$(endpoint)' - manuallySetRepository: true - githubOwner: '$(owner)' - githubRepositoryName: '$(repoName)' - githubReleaseNotes: |+ - $(releaseNotes) - - ### Changes: - $(Build.SourceVersionMessage) - githubReleaseDraft: false - githubReleasePrerelease: false - githubIgnoreAssets: false - githubReleaseAsset: | - $(Pipeline.Workspace)/betaflight-tx-lua-scripts/** - githubReuseRelease: true - githubReuseDraftOnly: true - githubSkipDuplicatedAssets: false - githubEditRelease: false - githubDeleteEmptyTag: false