Package ARM and Update Offer Artifact #9
Workflow file for this run
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: "2023-07-31-twas-base-single-server" | |
planId: "2023-07-31-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 "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 | |
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: | | |
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 }} |