Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/upload-release-assets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ defaults:
shell: bash

permissions:
contents: read
contents: write
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you need write permissions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needed to upload the packages to the release draft


jobs:
vars:
Expand Down Expand Up @@ -80,12 +80,12 @@ jobs:
find ${{inputs.pkgRepo}}/nginx-agent | grep -e "nginx-agent[_-]${{inputs.pkgVersion}}"

- name: GitHub Upload
continue-on-error: true
if: ${{ needs.vars.outputs.github_release == 'true' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# clobber overwrites existing assets of the same name
run: |
gh release list
gh release upload --clobber v${{ inputs.pkgVersion }} \
$(find ${{inputs.pkgRepo}}/nginx-agent | grep -e "nginx-agent[_-]${{inputs.pkgVersion}}")

Expand All @@ -101,7 +101,7 @@ jobs:
with:
inlineScript: |
for i in $(find ${{inputs.pkgRepo}}/nginx-agent | grep -e "nginx-agent[_-]${{inputs.pkgVersion}}"); do
dest="nginx-agent/${GITHUB_REF##*/}/${i##*/}"
dest="nginx-agent/release-${{ inputs.pkgVersion }}/${i##*/}"
echo "Uploading ${i} to ${dest}"
az storage blob upload --auth-mode=login -f "$i" -c ${{ secrets.AZURE_CONTAINER_NAME }} \
--account-name ${{ secrets.AZURE_ACCOUNT_NAME }} --overwrite -n ${dest}
Expand Down
17 changes: 15 additions & 2 deletions scripts/packages/package-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ if [[ ! -z ${CERT} ]] && [[ ! -z ${KEY} ]]; then
fi

if [[ -z ${PKG_REPO} ]]; then
echo "defaulting to packages.nginx.com"
echo "defaulting to packages.nginx.org"
PKG_REPO="packages.nginx.org"
fi

Expand All @@ -44,7 +44,6 @@ if [[ -z $VERSION ]]; then
echo "no version provided"
exit 1
fi

PKG_DIR="${PKG_REPO}/${PKG_NAME}"
PKG_REPO_URL="https://${PKG_DIR}"

Expand Down Expand Up @@ -93,6 +92,11 @@ CENTOS=(
centos/8/x86_64/RPMS/nginx-agent-$VERSION.el8.ngx.x86_64.rpm
)

FREEBSD=(
freebsd/FreeBSD:12:amd64/latest/nginx-agent-$VERSION.pkg
freebsd/FreeBSD:13:amd64/latest/nginx-agent-$VERSION.pkg
)

uris=(
${DEBIAN[@]}
${UBUNTU[@]}
Expand All @@ -102,6 +106,13 @@ uris=(
${SUSE[@]}
)

majorVersion=$(echo ${VERSION} | cut -d. -f1)
if [[ ${majorVersion} == 2 ]]; then
uris+=(${FREEBSD[@]})
fi

# Functions

## Check and download if nginx-agent packages are present in the repository
check_pkgs () {
for pkg in ${uris[@]}; do
Expand Down Expand Up @@ -158,5 +169,7 @@ check_repo() {
fi
}

# Main

check_repo
check_pkgs
Loading