Skip to content

Package ARM and Update Offer Artifact #25

Package ARM and Update Offer Artifact

Package ARM and Update Offer Artifact #25

Workflow file for this run

# Copyright (c) IBM Corporation.
# Copyright (c) Microsoft Corporation.
name: Package ARM and Update Offer Artifact
on:
workflow_dispatch:
inputs:
updateOfferArtifact:
description: 'Update offer artifact'
required: true
type: boolean
default: true
# Allows you to run this workflow using GitHub APIs
# PERSONAL_ACCESS_TOKEN=<GITHUB_PERSONAL_ACCESS_TOKEN>
# REPO_NAME=WASdev/azure.liberty.aks
# curl --verbose -XPOST -u "WASdev:${PERSONAL_ACCESS_TOKEN}" -H "Accept: application/vnd.github.everest-preview+json" -H "Content-Type: application/json" https://api.github.com/repos/${REPO_NAME}/actions/workflows/package.yaml/dispatches --data '{"ref": "master"}'
repository_dispatch:
types: [package]
# sample request
# PERSONAL_ACCESS_TOKEN=<GITHUB_PERSONAL_ACCESS_TOKEN>
# REPO_NAME=WASdev/azure.liberty.aks
# curl --verbose -X POST https://api.github.com/repos/${REPO_NAME}/dispatches -H "Accept: application/vnd.github.everest-preview+json" -H "Authorization: token ${PERSONAL_ACCESS_TOKEN}" --data '{"event_type": "package"}'
env:
repoName: "azure.liberty.aks"
offerId: "20210924-liberty-aks"
planId: "liberty-aks"
clientId: ${{ secrets.CLIENT_ID }}
secretValue: ${{ secrets.SECRET_VALUE }}
tenantId: ${{ secrets.TENANT_ID }}
offerType: 'application_offer'
jobs:
package:
runs-on: ubuntu-latest
steps:
- name: Get versions of external dependencies
run: |
curl -Lo external-deps-versions.properties https://raw.githubusercontent.com/Azure/azure-javaee-iaas/main/external-deps-versions.properties
source external-deps-versions.properties
echo "bicepVersion=${BICEP_VERSION}" >> $GITHUB_ENV
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
server-username: MAVEN_USERNAME # env variable for username
server-password: MAVEN_TOKEN # env variable for token
- name: Set Maven env
env:
MAVEN_USERNAME: github
MAVEN_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
echo "MAVEN_USERNAME=${MAVEN_USERNAME}" >> "$GITHUB_ENV"
echo "MAVEN_TOKEN=${MAVEN_TOKEN}" >> "$GITHUB_ENV"
- name: Set up bicep
run: |
curl -Lo bicep https://github.com/Azure/bicep/releases/download/${{ env.bicepVersion }}/bicep-linux-x64
chmod +x ./bicep
sudo mv ./bicep /usr/local/bin/bicep
bicep --version
- name: Download arm-ttk used in partner center pipeline
shell: bash
run: |
wget -O arm-template-toolkit.zip https://aka.ms/arm-ttk-azureapps
unzip arm-template-toolkit.zip -d arm-ttk
- name: Checkout ${{ env.repoName }}
uses: actions/checkout@v2
with:
path: ${{ env.repoName }}
ref: ${{ github.event.inputs.ref }}
- name: Build and test ${{ env.repoName }}
run: |
cd ${{ env.repoName }}
mvn -Pbicep -Passembly -Ptemplate-validation-tests clean install
- name: Generate artifact file name and path
id: artifact_file
run: |
echo "pwd=$(pwd)"
version=$(mvn -q -Dexec.executable=echo -Dexec.args='${version.${{ env.repoName }}}' --file ${{ env.repoName }}/pom.xml --non-recursive exec:exec)
artifactName=${{ env.repoName }}-$version-arm-assembly
unzip ${{ env.repoName }}/target/$artifactName.zip -d ${{ env.repoName }}/target/$artifactName
echo "##[set-output name=artifactName;]${artifactName}"
echo "##[set-output name=artifactPath;]${{ env.repoName }}/target/$artifactName"
echo "##[set-output name=artifactVersion;]${version}"
- name: Archive ${{ env.repoName }} template
uses: actions/upload-artifact@v1
if: success()
with:
name: ${{steps.artifact_file.outputs.artifactName}}
path: ${{steps.artifact_file.outputs.artifactPath}}
- name: Update offer artifact
if: ${{ inputs.updateOfferArtifact == true || github.event.client_payload.updateOfferArtifact == true }}
uses: microsoft/microsoft-partner-center-github-action@v3
with:
offerId: ${{ env.offerId }}
planId: ${{ env.planId }}
filePath: ${{ env.repoName }}/target/${{steps.artifact_file.outputs.artifactName}}.zip
artifactVersion: ${{steps.artifact_file.outputs.artifactVersion}}
clientId: ${{ env.clientId }}
secretValue: ${{ env.secretValue }}
tenantId: ${{ env.tenantId }}
offerType: ${{ env.offerType }}