Skip to content

Update nightly-build.yml #169

Update nightly-build.yml

Update nightly-build.yml #169

Workflow file for this run

name: Nightly Build
on:
workflow_dispatch:
# schedule:
# - cron: '0 20 * * *'
push:
branches:
- golib-release-proccess
jobs:
# last-commit:
# runs-on: ubuntu-latest
# steps:
# - name: Check if the last commit was today
# id: check-commit
# run: |
# LAST_COMMIT_DATE="$(date -u -d \
# $(curl -H "Accept: application/vnd.github.v3+json" \
# "https://api.github.com/repos/aerospike/aerospike-backup-service/commits" | \
# jq -r '.[0].commit.committer.date') "+%Y-%m-%d")"
# TODAY="$(date -u +%Y-%m-%d)"
# if [ "$LAST_COMMIT_DATE" == "$TODAY" ]; then
# echo "commit_today=true" >> "$GITHUB_OUTPUT"
# else
# echo "commit_today=false" >> "$GITHUB_OUTPUT"
# fi
# outputs:
# commit_today: ${{ steps.check-commit.outputs.commit_today }}
nightly-build:
# needs: last-commit
# if: ${{ needs.last-commit.outputs.commit_today == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.22.5"
- name: Install Dependencies
run: |
go install "github.com/goreleaser/nfpm/v2/cmd/nfpm@latest"
- name: Build Packages
env:
PAT: ${{ secrets.PAT }}
run: |
git config --global url."https://${PAT}:[email protected]/".insteadOf "https://github.com/"
make packages
- name: Find files matching "*.rpm" and "*.deb"
run: |
ASSET_LIST=$(find . -type f \( -name "*.deb" -or -name "*.rpm" \) | tr '\n' ',')
echo "ASSET_LIST=$ASSET_LIST" >> $GITHUB_ENV
- name: Upload Assets
run: |
IFS=',' read -r -a asset_array <<< "$ASSET_LIST"
for file in "${asset_array[@]}"; do
echo "file: $file"
BASENAME="$(basename ${file%.*})"
EXT="${file##*.}"
echo "ext: $EXT"
echo "basename: $BASENAME"
echo "curl \
-u${{ secrets.ARTIFACTORY_USER }}:${{ secrets.ARTIFACTORY_TOKEN }} \
-XPUT "https://aerospike.jfrog.io/artifactory/ecosystem-$EXT-dev-local/${{ github.event.repository.name }}/$(cat VERSION)/"$BASENAME"_$(date +%Y%m%d).$EXT" \
-T "$file""
done
# - name: Deploy Artifact
# run: |
# if [ ${{ matrix.ext }} == "rpm" ]; then
# curl \
# -u${{ secrets.ARTIFACTORY_USER }}:${{ secrets.ARTIFACTORY_TOKEN }} \
# -XPUT https://aerospike.jfrog.io/artifactory/ecosystem-${{ matrix.ext }}-dev-local/${{ steps.set-variables.outputs.repo }}/${{ steps.set-variables.outputs.version }}/${{ steps.set-variables.outputs.repo }}-${{ steps.set-variables.outputs.version }}-1.${{ matrix.distro_symbol }}.${{ steps.set-variables.outputs.arch }}_$(date +%Y%m%d).${{ matrix.ext }} \
# -T ${{ github.workspace }}/target/${{ steps.set-variables.outputs.repo }}-${{ steps.set-variables.outputs.version }}-1.${{ matrix.distro_symbol }}.${{ steps.set-variables.outputs.arch }}.${{ matrix.ext }}
# else
# curl \
# -u${{ secrets.ARTIFACTORY_USER }}:${{ secrets.ARTIFACTORY_TOKEN }} \
# -XPUT https://aerospike.jfrog.io/artifactory/ecosystem-${{ matrix.ext }}-dev-local/${{ steps.set-variables.outputs.repo }}/${{ steps.set-variables.outputs.version }}/${{ steps.set-variables.outputs.repo }}-${{ steps.set-variables.outputs.version }}-1.${{ matrix.distro_symbol }}.${{ steps.set-variables.outputs.arch }}_$(date +%Y%m%d).${{ matrix.ext }} \
# -T ${{ github.workspace }}/target/${{ steps.set-variables.outputs.repo }}_${{ steps.set-variables.outputs.version }}-1_${{ matrix.arch }}.${{ matrix.ext }}
# fi