Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/github_actions/liquibase/build-…
Browse files Browse the repository at this point in the history
…logic-0.7.8
  • Loading branch information
Sayali M authored and Sayali M committed Jul 11, 2024
2 parents 38236fb + c08a71e commit 1c2d3a7
Show file tree
Hide file tree
Showing 8 changed files with 176 additions and 20 deletions.
118 changes: 118 additions & 0 deletions .github/workflows/attach-artifact-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
name: Attach Artifact to Release

on:
workflow_dispatch:
inputs:
version:
description: 'LPM version to release'
required: true

env:
VERSION: ${{ inputs.version }}

jobs:
prepare-release:
name: Prepare Release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.get-release.outputs.upload_url }}

steps:
- uses: actions/checkout@v4

- name: Get latest draft release ID
id: get-release
run: |
LATEST_DRAFT_RELEASE=$(curl -X GET -H "Authorization: token ${{ secrets.BOT_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/releases?per_page=1" | jq -r 'if .[].draft == true then .[].id else empty end')
LATEST_DRAFT_RELEASE_URL=$(curl -X GET -H "Authorization: token ${{ secrets.BOT_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/releases?per_page=1" | jq -r 'if .[].draft == true then .[].upload_url else empty end')
echo "Latest Draft Release ID: $LATEST_DRAFT_RELEASE"
echo "Latest Draft Release upload_url: $LATEST_DRAFT_RELEASE_URL"
echo "RELEASE_ID=$LATEST_DRAFT_RELEASE" >> $GITHUB_ENV
echo "upload_url=$LATEST_DRAFT_RELEASE_URL" >> $GITHUB_OUTPUT
- name: List artifacts in release
if: env.RELEASE_ID != '' && env.RELEASE_ID != null
id: list-artifacts
run: |
RELEASE_ID="${{ env.RELEASE_ID }}"
ARTIFACTS=$(curl -X GET -H "Authorization: token ${{ secrets.BOT_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/releases/$RELEASE_ID/assets" | jq -r '.[].id')
echo "Artifacts to delete: $ARTIFACTS"
ARTIFACTS_CLEANED=$(echo "$ARTIFACTS" | tr -s '[:space:]' ',' | sed 's/,$//')
echo "ARTIFACTS_TO_DELETE=$ARTIFACTS_CLEANED" >> $GITHUB_ENV
- name: Delete artifacts
if: env.ARTIFACTS_TO_DELETE != null
run: |
RELEASE_ID="${{ env.RELEASE_ID }}"
ARTIFACTS_TO_DELETE="${{ env.ARTIFACTS_TO_DELETE }}"
IFS=',' read -ra values <<< "$ARTIFACTS_TO_DELETE"
for value in "${values[@]}"; do
curl -X DELETE -H "Authorization: token ${{ secrets.BOT_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/releases/assets/$value"
echo "Deleted artifact ID: $value"
done
- name: Edit Release
uses: irongut/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
id: ${{ env.RELEASE_ID }}
name: v${{ env.VERSION }}
replacename: true

attach-to-release:
runs-on: ubuntu-latest
needs: prepare-release
strategy:
matrix:
arch: [
{folder: darwin_amd64, zip_name: darwin},
{folder: darwin_arm64, zip_name: darwin-arm64},
{folder: linux_amd64, zip_name: linux},
{folder: linux_arm64, zip_name: linux-arm64},
{folder: s390x, zip_name: s390x},
{folder: windows, zip_name: windows},
]

steps:

- uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '^1.22'

- name: Setup GO environment
run: |
go mod download
- name: Update VERSION file
run: echo $VERSION > VERSION

- name: Release Artifact
run: make release

- name: Attach artifact to release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.prepare-release.outputs.upload_url }}
asset_path: bin/${{ matrix.arch.folder }}/lpm-${{ env.VERSION }}-${{ matrix.arch.zip_name }}.zip
asset_name: lpm-${{ env.VERSION }}-${{ matrix.arch.zip_name }}.zip
asset_content_type: application/zip

- name: Calculate SHA256 hash
if: matrix.arch.zip_name == 'linux' || matrix.arch.zip_name == 'linux-arm64'
id: calculate-sha256
run: |
sha256sum bin/${{ matrix.arch.folder }}/lpm-${{ env.VERSION }}-${{ matrix.arch.zip_name }}.zip | awk '{ print $1 }' > sha256.txt
SHA256=$(cat sha256.txt)
echo "SHA256=$SHA256" >> $GITHUB_ENV
echo "SHA256 hash: $SHA256"
- name: Upload SHA256 hash to job summary
if: matrix.arch.zip_name == 'linux' || matrix.arch.zip_name == 'linux-arm64'
run: |
echo "### :white_check_mark: SHA256 for ${{ matrix.arch.zip_name }}" >> $GITHUB_STEP_SUMMARY
echo "- lpm-${{ env.VERSION }}-${{ matrix.arch.zip_name }}.zip: $SHA256" >> $GITHUB_STEP_SUMMARY
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:

jobs:
codeql:
uses: liquibase/build-logic/.github/workflows/codeql.yml@v0.7.8
uses: liquibase/build-logic/.github/workflows/codeql.yml@main
secrets: inherit
with:
languages: '["go"]'
17 changes: 17 additions & 0 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Create Release

on:
push:
branches:
- master

jobs:
create-release:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Create Release Draft
id: create-release
uses: release-drafter/release-drafter@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
14 changes: 0 additions & 14 deletions .github/workflows/release-drafter.yml

This file was deleted.

File renamed without changes.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
module package-manager

go 1.22.0
go 1.22.5

require (
github.com/google/go-github/v39 v39.2.0
github.com/hashicorp/go-version v1.7.0
github.com/spf13/cobra v1.8.0
github.com/spf13/cobra v1.8.1
github.com/vifraa/gopom v1.0.0
golang.org/x/oauth2 v0.20.0
)
Expand Down
6 changes: 3 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
Expand All @@ -18,8 +18,8 @@ github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLf
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0=
github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho=
github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM=
github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
Expand Down
35 changes: 35 additions & 0 deletions internal/app/packages.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@
"algorithm": "SHA1",
"checksum": "dc3c418a258e0228522046b48c5c77d7119685f6",
"liquibaseCore": "4.26.0"
},
{
"tag": "1.2.0",
"path": "https://repo1.maven.org/maven2/org/liquibase/ext/liquibase-databricks/1.2.0/liquibase-databricks-1.2.0.jar",
"algorithm": "SHA1",
"checksum": "c8244dec9ca0e374dc5de87688b8af857065da6d",
"liquibaseCore": "4.28.0"
}
]
},
Expand Down Expand Up @@ -482,6 +489,13 @@
"algorithm": "SHA1",
"checksum": "267298601816385f54620b08d131979b3fdb8aae",
"liquibaseCore": "4.24.0"
},
{
"tag": "1.4.0",
"path": "https://repo1.maven.org/maven2/org/liquibase/ext/liquibase-commercial-mongodb/1.4.0/liquibase-commercial-mongodb-1.4.0.jar",
"algorithm": "SHA1",
"checksum": "50924b8a4a28998cf95f7ee13412e4203f1089e1",
"liquibaseCore": "4.28.0"
}
]
},
Expand Down Expand Up @@ -516,6 +530,13 @@
"algorithm": "SHA1",
"checksum": "7a371751ff0c6c53ed5641a8814abc66c6e3213a",
"liquibaseCore": "4.24.0"
},
{
"tag": "0.1.4",
"path": "https://repo1.maven.org/maven2/org/liquibase/ext/liquibase-git-resource/0.1.4/liquibase-git-resource-0.1.4.jar",
"algorithm": "SHA1",
"checksum": "1c7d32aab8144c30693af08abe787200b9273a16",
"liquibaseCore": "4.24.0"
}
]
},
Expand Down Expand Up @@ -2890,6 +2911,13 @@
"algorithm": "SHA1",
"checksum": "8555c90692ba8072f082c1fcaebd391ef518e15c",
"liquibaseCore": ""
},
{
"tag": "12.6.3",
"path": "https://repo1.maven.org/maven2/com/microsoft/sqlserver/mssql-jdbc/12.6.3.jre11/mssql-jdbc-12.6.3.jre11.jar",
"algorithm": "SHA1",
"checksum": "88e2be5bc1ac4debaef4cd768a65c76808f3e532",
"liquibaseCore": ""
}
]
},
Expand Down Expand Up @@ -5861,6 +5889,13 @@
"algorithm": "SHA1",
"checksum": "d4beb5366863a50784316f0cd3ea92e3e687a0f0",
"liquibaseCore": ""
},
{
"tag": "3.17.0",
"path": "https://repo1.maven.org/maven2/net/snowflake/snowflake-jdbc/3.17.0/snowflake-jdbc-3.17.0.jar",
"algorithm": "SHA1",
"checksum": "31fc2bfe01ed20c86140f65f12a7bc6d803473d3",
"liquibaseCore": ""
}
]
},
Expand Down

0 comments on commit 1c2d3a7

Please sign in to comment.