Skip to content

Commit

Permalink
Merge pull request #256 from Adyen/automation/release
Browse files Browse the repository at this point in the history
Release v9.0.2
  • Loading branch information
antolo-arch authored Aug 21, 2023
2 parents 1c26611 + 5220b41 commit d81177b
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 96 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @Adyen/api-libraries-reviewers @rikterbeek @acampos1916 @candemiralp
* @Adyen/integration-tools-testing
43 changes: 8 additions & 35 deletions .github/workflows/gh-release.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,16 @@
name: Github Release

on:
workflow_dispatch:
push:
branches:
- main
workflow_dispatch:
push:
branches:
- main

jobs:
gh_release:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.ADYEN_AUTOMATION_BOT_ACCESS_TOKEN }}
- name: Get the release script
run: |
wget https://raw.githubusercontent.com/Adyen/adyen-node-api-library/develop/.github/scripts/release.js -P ./.github/scripts
- name: Grab version
uses: actions/github-script@v6
id: release
with:
script: |
const release = require('./.github/scripts/release.js')
core.setOutput('version', release.setupPythonVersion())
- name: Create new release
env:
GH_TOKEN: ${{ secrets.ADYEN_AUTOMATION_BOT_ACCESS_TOKEN }}
run: |
gh release create v${{steps.release.outputs.version}} \
--title 'Adyen Python API Library v${{steps.release.outputs.version}}' \
--generate-notes --target main
- name: Delete the release script
run: |
rm -f ./.github/scripts/release.js
- name: Update develop branch
run: |
git checkout develop
git merge main
git push origin develop
uses: Adyen/adyen-node-api-library/.github/workflows/lib-gh-release.yml@develop
with:
project-name: Python
secrets: inherit
61 changes: 6 additions & 55 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,64 +1,15 @@
name: Release request

on:
workflow_dispatch:
push:
branches:
- develop
workflow_dispatch:
push:
branches:
- develop

jobs:
release:
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: main
- name: Reset promotion branch
run: |
git fetch origin develop:develop
git reset --hard develop
- name: Get the release script
run: |
wget https://raw.githubusercontent.com/Adyen/adyen-node-api-library/develop/.github/scripts/release.js -P ./.github/scripts
- name: Prepare release request
uses: actions/github-script@v6
id: release
with:
script: |
const release = require('./.github/scripts/release.js')
const options = { github, context, core, getCurrentVersion: release.setupPythonVersion };
await release.bump(options);
- name: Bump version
uses: actions/github-script@v6
with:
script: |
const release = require('./.github/scripts/release.js')
await release.updatePythonVersion("${{steps.release.outputs.nextVersion}}");
- name: Delete the release script
run: |
rm -f ./.github/scripts/release.js
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@284f54f989303d2699d373481a0cfa13ad5a6666 # v5.0.1
with:
token: ${{ secrets.ADYEN_AUTOMATION_BOT_ACCESS_TOKEN }}
committer: ${{ secrets.ADYEN_AUTOMATION_BOT_EMAIL }}
author: ${{ secrets.ADYEN_AUTOMATION_BOT_EMAIL }}
branch: automation/release
title: Release v${{steps.release.outputs.nextVersion}}
body: |
Merged pull requests to be released:
${{steps.release.outputs.changelog}}
commit-message: "chore(release): bump to ${{steps.release.outputs.nextVersion}}"
delete-branch: true
- name: Enable Pull Request Automerge
if: steps.cpr.outputs.pull-request-operation == 'created'
uses: peter-evans/enable-pull-request-automerge@a660677d5469627102a1c1e11409dd063606628d # v3.0.0
with:
token: ${{ secrets.ADYEN_AUTOMATION_BOT_ACCESS_TOKEN }}
pull-request-number: ${{ steps.cpr.outputs.pull-request-number }}
merge-method: merge

uses: Adyen/adyen-node-api-library/.github/workflows/lib-release.yml@develop
secrets: inherit
2 changes: 1 addition & 1 deletion Adyen/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@
API_LEGAL_ENTITY_MANAGEMENT_VERSION = "v3"
API_STORED_VALUE_VERSION = "v46"
LIB_NAME = "adyen-python-api-library"
LIB_VERSION = "9.0.1"
LIB_VERSION = "9.0.2"
3 changes: 3 additions & 0 deletions Adyen/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ def generate_notification_sig(dict_object, hmac_key):
def is_valid_hmac_notification(dict_object, hmac_key):
dict_object = dict_object.copy()

if 'notificationItems' in dict_object:
dict_object = dict_object['notificationItems'][0]['NotificationRequestItem']

if 'additionalData' in dict_object:
if dict_object['additionalData']['hmacSignature'] == "":
raise ValueError("Must Provide hmacSignature in additionalData")
Expand Down
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,14 @@ generateCheckoutTest: build/spec $(openapi-generator-jar)
--skip-validate-spec
cp $(output)/api/api-test.py test/methodNamesTests/checkoutTest.py
rm -rf build

## Releases

version:
grep version= setup.py | tr -d \', | awk -F '=' '{ printf "currentVersion=%s\n", $$2 }' >> "$$GITHUB_OUTPUT"

bump:
perl -i -pe 's/$$ENV{"CURRENT_VERSION"}/$$ENV{"NEXT_VERSION"}/' setup.py Adyen/settings.py


.PHONY: $(services) version bump
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Adyen APIs Library for Python

[![version](https://img.shields.io/pypi/v/Adyen.svg)](https://docs.adyen.com/development-resources/libraries)
[![version](https://img.shields.io/pypi/v/Adyen.svg)](https://pypi.org/project/Adyen/)

This is the officially supported Python library for using Adyen's APIs.

Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[bdist_wheel]

[metadata]
description-file = README.md
description_file = README.md

[egg_info]
tag_build =
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
setup(
name='Adyen',
packages=find_packages(include="Adyen*"),
version='9.0.1',
version='9.0.2',
maintainer='Adyen',
maintainer_email='[email protected]',
description='Adyen Python Api',
Expand Down
2 changes: 1 addition & 1 deletion test/UtilTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def test_notification_request_item_hmac(self):
{'hmacSignature': hmac_calculation_str})
self.assertTrue(hmac_validate)

def test_notifications_with_slashes(self):
def test_webhooks_with_slashes(self):
hmac_key = "74F490DD33F7327BAECC88B2947C011FC02D014A473AAA33A8EC93E4DC069174"
with open('test/mocks/util/backslash_notification.json') as file:
backslash_notification = load(file)
Expand Down

0 comments on commit d81177b

Please sign in to comment.