Skip to content

Commit

Permalink
chore(build): get the branch name correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
ADD-SP authored and fffonion committed Apr 28, 2023
1 parent 1c2ddf4 commit 267025c
Showing 1 changed file with 39 additions and 8 deletions.
47 changes: 39 additions & 8 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ name: Tests
on:
pull_request:
push:
branches:
- master

env:
KONG_VERSION: master
Expand All @@ -30,13 +28,28 @@ jobs:
ref: ${{ env.KONG_VERSION }}
path: kong

- name: Set the KONG_NGINX_MODULE_BRANCH in kong/.requirements
run: |
cd kong
branch=""
if [ ${{ github.event_name }} == 'pull_request' ]; then
branch=${GITHUB_HEAD_REF}
else
branch=${GITHUB_REF}
fi
branch=$(echo "$branch" | sed 's/\//\\\//g')
sed -i "s/KONG_NGINX_MODULE_BRANCH=.\+/KONG_NGINX_MODULE_BRANCH=${branch}/" .requirements
cat .requirements
- name: Lookup build cache
id: cache-deps
uses: actions/cache@v3
with:
path: |
${{ env.BUILD_ROOT }}
key: ${{ hashFiles('src/**', 'lualib/**', '.github/workflows/tests.yml') }}
key: ${{ hashFiles('src/**', 'lualib/**', '.github/workflows/tests.yml', 'kong/.requirements') }}

- name: Install packages
if: steps.cache-deps.outputs.cache-hit != 'true'
Expand All @@ -48,10 +61,6 @@ jobs:
if: steps.cache-deps.outputs.cache-hit != 'true'
run: |
cd kong
branch=${GITHUB_HEAD_REF}
branch=$(echo "$branch" | sed 's/\//\\\//g')
sed -i "s/KONG_NGINX_MODULE_BRANCH=.\+/KONG_NGINX_MODULE_BRANCH=${branch}/" .requirements
cat .requirements
make build-kong
make build-venv
BUILD_PREFIX=$BUILD_ROOT/kong-dev
Expand All @@ -70,13 +79,35 @@ jobs:
- name: Checkout source code
uses: actions/checkout@v3

- name: Checkout Kong source code
uses: actions/checkout@v3
with:
repository: kong/kong
ref: ${{ env.KONG_VERSION }}
path: kong

- name: Set the KONG_NGINX_MODULE_BRANCH in kong/.requirements
run: |
cd kong
branch=""
if [ ${{ github.event_name }} == 'pull_request' ]; then
branch=${GITHUB_HEAD_REF}
else
branch=${GITHUB_REF}
fi
branch=$(echo "$branch" | sed 's/\//\\\//g')
sed -i "s/KONG_NGINX_MODULE_BRANCH=.\+/KONG_NGINX_MODULE_BRANCH=${branch}/" .requirements
cat .requirements
- name: Load build cache
id: cache-deps
uses: actions/cache@v3
with:
path: |
${{ env.BUILD_ROOT }}
key: ${{ hashFiles('src/**', 'lualib/**', '.github/workflows/tests.yml') }}
key: ${{ hashFiles('src/**', 'lualib/**', '.github/workflows/tests.yml', 'kong/.requirements') }}

- name: Install packages
run: |
Expand Down

0 comments on commit 267025c

Please sign in to comment.