Package ARM and Update Offer Artifact #24
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright (c) Microsoft Corporation. | |
# Copyright (c) IBM Corporation. | |
name: Package ARM | |
on: | |
workflow_dispatch: | |
# Allows you to run this workflow using GitHub APIs | |
# PERSONAL_ACCESS_TOKEN=<GITHUB_PERSONAL_ACCESS_TOKEN> | |
# REPO_NAME=WASdev/azure.websphere-traditional.singleserver | |
# 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": "main"}' | |
repository_dispatch: | |
types: [package] | |
# sample request | |
# PERSONAL_ACCESS_TOKEN=<GITHUB_PERSONAL_ACCESS_TOKEN> | |
# REPO_NAME=WASdev/azure.websphere-traditional.singleserver | |
# 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.websphere-traditional.singleserver" | |
offerId: "2022-01-07-twas-base-single-server" | |
planId: "2022-01-07-twas-base-single-server" | |
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 "azCliVersion=${AZ_CLI_VERSION}" >> $GITHUB_ENV | |
echo "bicepVersion=${BICEP_VERSION}" >> $GITHUB_ENV | |
echo "refArmttk=${ARM_TTK_REFERENCE}" >> $GITHUB_ENV | |
echo "refJavaee=${AZURE_JAVAEE_IAAS_REFERENCE}" >> $GITHUB_ENV | |
- name: Set up JDK 1.8 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 1.8 | |
- 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: Checkout azure-javaee-iaas | |
uses: actions/checkout@v2 | |
with: | |
repository: Azure/azure-javaee-iaas | |
path: azure-javaee-iaas | |
ref: ${{ env.refJavaee }} | |
- name: Download arm-ttk used in partner center pipeline | |
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 azure-javaee-iaas | |
run: mvn -DskipTests clean install --file azure-javaee-iaas/pom.xml | |
- 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: | | |
version=$(awk '/<version>[^<]+<\/version>/{gsub(/<version>|<\/version>/,"",$1);print $1;exit;}' ${{ env.repoName }}/pom.xml) | |
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 | |
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 }} |