Skip to content

Commit

Permalink
[BIA-478] GitHub Actions: Packaging (#172)
Browse files Browse the repository at this point in the history
- Add github actions workflow to create a pre-release.
- Add a new secret SEMANTIC_VERSION to share the version between build and create-pre-release workflows.
  • Loading branch information
jleiva-gap authored Dec 2, 2021
1 parent 30e642e commit 92731ef
Show file tree
Hide file tree
Showing 2 changed files with 97 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
workflow_dispatch:

env:
BUILD_VERSION: "2.6.1"
BUILD_VERSION: ${{ secrets.SEMANTIC_VERSION }}
CONFIGURATION: "Release"
GA_USE_GITHUB_ENV: "true"
USE_MSSQL_DEFAULT_CONN_STRING: "FALSE"
Expand Down
96 changes: 96 additions & 0 deletions .github/workflows/create-pre-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# SPDX-License-Identifier: Apache-2.0
# Licensed to the Ed-Fi Alliance under one or more agreements.
# The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0.
# See the LICENSE and NOTICES files in the project root for more information.

name: Create Release/Pre-Release

on:
workflow_dispatch:
inputs:
releaseName:
description: 'Release Name'
required: true
default: '<AMT>'
releaseDescription:
description: 'Release Description'
required: true
default: '<Description>'
createRelease:
description: 'Create Release'
required: true
default: 'false'

env:
BUILD_VERSION: ${{ secrets.SEMANTIC_VERSION }}
CONFIGURATION: "Release"
PUBLISH_FOLDER: "./publish/"
PUBLISH_FDD_ZIP: "EdFi.AnalyticsMiddleTier.zip"
PUBLISH_SCD_ZIP: "EdFi.AnalyticsMiddleTier-win10.x64.zip"

jobs:
AMT-Create-Release:
runs-on: Ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Caching packages
uses: actions/cache@v2
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Publish self-contained deployment
run: |
.\build.ps1 publish -SelfContained ${{ env.CONFIGURATION }} -Version ${{ env.BUILD_VERSION }} -BuildCounter ${{ github.run_number }}
shell: pwsh

- name: Publish framework-dependent deployment
run: |
.\build.ps1 publish -Configuration ${{ env.CONFIGURATION }} -Version ${{ env.BUILD_VERSION }} -BuildCounter ${{ github.run_number }}
shell: pwsh

- name: Create Zip file
run: |
.\build.ps1 CreateZip -Configuration ${{ env.CONFIGURATION }} -Version ${{ env.BUILD_VERSION }} -BuildCounter ${{ github.run_number }}
shell: pwsh

- name: Create pre-release
id: create_pre_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
RELEASE_TAG: ${{ contains( github.event.inputs.createRelease, 'true') && env.BUILD_VERSION || format('{0}-pre-{1}', env.BUILD_VERSION, github.run_id) }}
with:
tag_name: ${{ env.RELEASE_TAG }}
release_name: ${{ env.BUILD_VERSION }} ${{ github.event.inputs.releaseName }}
body: |
${{ github.event.inputs.releaseDescription }}
draft: false
prerelease: ${{ !contains( github.event.inputs.createRelease, 'true') }}

- name: Upload publish zip
id: upload-publish-zip-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_pre_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ${{ env.PUBLISH_FOLDER }}${{ env.PUBLISH_FDD_ZIP }}
asset_name: ${{ env.PUBLISH_FDD_ZIP }}
asset_content_type: application/zip

- name: Upload self-contained publish zip
id: upload-publish-self-contained-zip-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_pre_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ${{ env.PUBLISH_FOLDER }}${{ env.PUBLISH_SCD_ZIP }}
asset_name: ${{ env.PUBLISH_SCD_ZIP }}
asset_content_type: application/zip

0 comments on commit 92731ef

Please sign in to comment.