Skip to content

Update release.yml

Update release.yml #41

Workflow file for this run

name: Create a Release and Push Release assets
on:
push:
branches:
- '**'
# push:
# tags:
# - '*'
workflow_dispatch:
jobs:
# create-release:
# runs-on: ubuntu-latest
# outputs:
# upload_url: ${{ steps.create-release.outputs.upload_url }}
# steps:
# - name: Check if release exists
# id: check-release
# uses: actions/github-script@v7
# with:
# script: |
# try {
# const response = await github.rest.repos.getReleaseByTag({
# owner: context.repo.owner,
# repo: context.repo.repo,
# tag: "${{ github.ref_name }}"
# });
#
# if (response.status === 200) {
# console.log(`Release with tag exists.`);
# core.setOutput('release-exists', 'true');
# }
# } catch (error) {
# if (error.status === 404) {
# console.log(`Release with tag does not exist.`);
# core.setOutput('release-exists', 'false');
# } else {
# throw error;
# }
# }
# github-token: ${{ secrets.GITHUB_TOKEN }}
# - uses: actions/create-release@v1
# if: ${{ steps.check-release.outputs.release-exists == 'false'}}
# id: create-release
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# tag_name: ${{ github.ref }}
# release_name: Release ${{ github.ref }}
# draft: true
# prerelease: true
build-artifacts:
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: Setup access for private go modules
run: |
git config --global url."ssh://[email protected]/".insteadOf https://github.com/
- name: Install Dependencies
run: |
go install "github.com/goreleaser/nfpm/v2/cmd/nfpm@latest"
- name: Build Packages
env:
GOPRIVATE: github.com/aerospike/backup-go
run: |
make packages
# make-packages:
# needs: create-release
# strategy:
# fail-fast: false
# matrix:
# arch: ["amd64","arm64"]
# container: [ "rhel8:latest", "rhel9:latest", "ubuntu2204:latest"]
# include:
# - container: "rhel8:latest"
# cmd: "make rpm"
# distro_symbol: "el8"
# ext: "rpm"
# - container: "rhel9:latest"
# cmd: "make rpm"
# distro_symbol: "el9"
# ext: "rpm"
# - container: "ubuntu2204:latest"
# cmd: "make deb"
# distro_symbol: "debian"
# ext: "deb"
# runs-on: ubuntu-latest
# steps:
# - name: Checkout Code
# uses: actions/checkout@v4
# - name: Set up QEMU
# uses: docker/setup-qemu-action@v3
# - name: Setup Jfrog
# uses: jfrog/setup-jfrog-cli@v3
# env:
# JF_URL: ${{ secrets.ARTIFACTORY_URL }}
# JF_ACCESS_TOKEN: ${{ secrets.ARTIFACTORY_TOKEN }}
# - name: Login to JFrog
# uses: docker/login-action@v2
# with:
# registry: aerospike.jfrog.io
# username: ${{ secrets.ARTIFACTORY_USER }}
# password: ${{ secrets.ARTIFACTORY_TOKEN }}
# - name: Create target directory
# run: mkdir -p ${{ github.workspace }}/target
# - name: Create lib directory
# run: mkdir -p ${{ github.workspace }}/lib
# - name: Build artifact
# id: build-artifact
# env:
# ARTIFACTORY_CONTAINER_DEV_URL: ${{ vars.ARTIFACTORY_CONTAINER_DEV_URL }}
# run: |
# docker run -v ${{ github.workspace }}:/aerospike-backup-service/ \
# -w /aerospike-backup-service/ \
# --platform linux/${{ matrix.arch }} "$ARTIFACTORY_CONTAINER_DEV_URL"/base-${{ matrix.container }} ${{ matrix.cmd }}
# - name: Set variable arch variable based on condition
# id: set-variables
# run: |
# if [ "${{ matrix.arch }}" == "arm64" ]; then
# echo "arch=aarch64" >> $GITHUB_OUTPUT
# else
# echo "arch=x86_64" >> $GITHUB_OUTPUT
# fi
# REPO_NAME="$(echo $GITHUB_REPOSITORY | cut -d '/' -f 2)"
# echo "repo=$REPO_NAME" >> $GITHUB_OUTPUT
# VERSION="$(cat VERSION)"
# echo "version=$VERSION" >> $GITHUB_OUTPUT
# - name: Checksum the package
# id: package-checksum
# run: |
# if [ "${{ matrix.ext }}" == "rpm" ]; then
# sha256sum ${{ github.workspace }}/target/${{ steps.set-variables.outputs.repo }}-${{ steps.set-variables.outputs.version }}-1.${{ matrix.distro_symbol }}.${{ steps.set-variables.outputs.arch }}.${{ matrix.ext }} | cut -d' ' -f1 > \
# ${{ github.workspace }}/target/${{ steps.set-variables.outputs.repo }}-${{ steps.set-variables.outputs.version }}-1.${{ matrix.distro_symbol }}.${{ steps.set-variables.outputs.arch }}.${{ matrix.ext }}.sha256
# fi
#
# if [ "${{ matrix.ext }}" == "deb" ]; then
# sha256sum ${{ github.workspace }}/target/${{ steps.set-variables.outputs.repo }}_${{ steps.set-variables.outputs.version }}-1_${{ matrix.arch }}.${{ matrix.ext }} | cut -d' ' -f1 > \
# ${{ github.workspace }}/target/${{ steps.set-variables.outputs.repo }}_${{ steps.set-variables.outputs.version }}-1_${{ matrix.arch }}.${{ matrix.ext }}.sha256
# fi
# - uses: actions/upload-release-asset@v1
# if: ${{ matrix.ext == 'rpm' }}
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ needs.create-release.outputs.upload_url }}
# asset_path: ${{ github.workspace }}/target/${{ steps.set-variables.outputs.repo }}-${{ steps.set-variables.outputs.version }}-1.${{ matrix.distro_symbol }}.${{ steps.set-variables.outputs.arch }}.${{ matrix.ext }}
# asset_name: ${{ steps.set-variables.outputs.repo }}-${{ steps.set-variables.outputs.version }}-1.${{ matrix.distro_symbol }}.${{ steps.set-variables.outputs.arch }}.${{ matrix.ext }}
# asset_content_type: application/x-${{ matrix.ext }}
# - uses: actions/upload-release-asset@v1
# if: ${{ matrix.ext == 'rpm' }}
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ needs.create-release.outputs.upload_url }}
# asset_path: ${{ github.workspace }}/target/${{ steps.set-variables.outputs.repo }}-${{ steps.set-variables.outputs.version }}-1.${{ matrix.distro_symbol }}.${{ steps.set-variables.outputs.arch }}.${{ matrix.ext }}.sha256
# asset_name: ${{ steps.set-variables.outputs.repo }}-${{ steps.set-variables.outputs.version }}-1.${{ matrix.distro_symbol }}.${{ steps.set-variables.outputs.arch }}.${{ matrix.ext }}.sha256
# asset_content_type: text/plain
# - uses: actions/upload-release-asset@v1
# if: ${{ matrix.ext == 'deb' }}
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ needs.create-release.outputs.upload_url }}
# asset_path: ${{ github.workspace }}/target/${{ steps.set-variables.outputs.repo }}_${{ steps.set-variables.outputs.version }}-1_${{ matrix.arch }}.${{ matrix.ext }}
# asset_name: ${{ steps.set-variables.outputs.repo }}_${{ steps.set-variables.outputs.version }}-1_${{ matrix.arch }}.${{ matrix.ext }}
# asset_content_type: application/x-${{ matrix.ext }}
# - uses: actions/upload-release-asset@v1
# if: ${{ matrix.ext == 'deb' }}
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ needs.create-release.outputs.upload_url }}
# asset_path: ${{ github.workspace }}/target/${{ steps.set-variables.outputs.repo }}_${{ steps.set-variables.outputs.version }}-1_${{ matrix.arch }}.${{ matrix.ext }}.sha256
# asset_name: ${{ steps.set-variables.outputs.repo }}_${{ steps.set-variables.outputs.version }}-1_${{ matrix.arch }}.${{ matrix.ext }}.sha256
# asset_content_type: text/plain