MOL-219/PICT-233: add LICENSE #31
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
name: Publish | |
on: | |
push: | |
tags: | |
# Release tags v1.0.0, v1.0.1, v1.0.2, etc. | |
- 'v[0-9]+.[0-9]+.[0-9]+' | |
# Pre-release tags v1.0.0-alpha.0, v1.0.0-beta.0, etc. | |
- 'v[0-9]+.[0-9]+.[0-9]+-[a-z]+.[0-9]+' | |
- latest | |
workflow_dispatch: | |
jobs: | |
publish: | |
name: Publish for commercetools Checkout | |
runs-on: ubuntu-latest | |
if: github.ref_type == 'tag' | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
- name: Setup Node.js 20 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20.9.0" | |
- name: Install | |
env: | |
CTP_CLIENT_ID: ${{ secrets.CTP_CLIENT_ID }} | |
CTP_CLIENT_SECRET: ${{ secrets.CTP_CLIENT_SECRET }} | |
CTP_CONNECTOR_KEY: ${{ secrets.CTP_CONNECTOR_KEY }} | |
CTP_REGION: ${{ secrets.CTP_REGION }} | |
run: | | |
echo Updating connector to tag $GITHUB_REF_NAME | |
echo Authenticating with commercetools | |
OAUTH_RESPONSE=$(curl --silent --show-error --location --request POST "https://auth.$CTP_REGION.commercetools.com/oauth/token?grant_type=client_credentials" -u $CTP_CLIENT_ID:$CTP_CLIENT_SECRET) | |
ACCESS_TOKEN=$(echo $OAUTH_RESPONSE | jq -r '.access_token') | |
echo Access token retrieved | |
CONNECTOR_DETAILS=$(curl --silent --show-error --location "https://connect.$CTP_REGION.commercetools.com/connectors/drafts/key=$CTP_CONNECTOR_KEY" \ | |
--header 'Content-Type: application/json' \ | |
--header "Authorization: Bearer $ACCESS_TOKEN") | |
VERSION=$(echo $CONNECTOR_DETAILS | jq -r '.version') | |
echo Updating version $VERSION | |
curl --fail-with-body --silent --location POST "https://connect.$CTP_REGION.commercetools.com/connectors/drafts/key=$CTP_CONNECTOR_KEY" \ | |
--header 'Content-Type: application/json' \ | |
--header "Authorization: Bearer $ACCESS_TOKEN" \ | |
--data-raw "{\"version\": $VERSION, \"actions\": [{\"action\": \"setRepository\",\"url\": \"[email protected]:mollie/commercetools-connector.git\",\"tag\": \"$GITHUB_REF_NAME\"},{\"action\": \"updatePreviewable\"},{\"action\":\"publish\",\"certification\": false}]}" |