-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable creation of full, offline binary releases (w/dependencies) (#16)
- Loading branch information
1 parent
18bfc2e
commit ec8e5f2
Showing
5 changed files
with
286 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
name: Create a binary distribution (full) | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
release-version: | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
dist: | ||
name: Binary distribution (full) | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- id: filenames | ||
name: Archive names | ||
run: | | ||
echo "diktat-cli-tar=diktat-cli-${{ inputs.release-version }}-full.tar" >>"${GITHUB_OUTPUT}" | ||
echo "diktat-cli-tgz=diktat-cli-${{ inputs.release-version }}-full.tar.gz" >>"${GITHUB_OUTPUT}" | ||
echo "diktat-cli-zip=diktat-cli-${{ inputs.release-version }}-full.zip" >>"${GITHUB_OUTPUT}" | ||
shell: bash | ||
|
||
- uses: actions/setup-java@v3 | ||
with: | ||
distribution: zulu | ||
java-version: 17 | ||
|
||
- name: Download dependencies | ||
run: | | ||
bin/diktat --no-download-progress -V | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
shell: bash | ||
|
||
- name: Archive | ||
run: | | ||
tar cf '${{ steps.filenames.outputs.diktat-cli-tar }}' --exclude-backups --exclude-vcs --exclude-vcs-ignore --exclude='*.bat' --exclude='*.cmd' -C bin . | ||
gzip -9 '${{ steps.filenames.outputs.diktat-cli-tar }}' | ||
zip -jrX9 -Z bzip2 '${{ steps.filenames.outputs.diktat-cli-zip }}' bin | ||
shell: bash | ||
|
||
# Upload a .tar.gz artifact, except when this is a release. | ||
- name: Upload ${{ steps.filenames.outputs.diktat-cli-tgz }} | ||
if: ${{ github.ref_type == 'branch' }} | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ steps.filenames.outputs.diktat-cli-tgz }} | ||
path: ${{ steps.filenames.outputs.diktat-cli-tgz }} | ||
if-no-files-found: error | ||
retention-days: 1 | ||
|
||
# Upload a .zip artifact, except when this is a release. | ||
- name: Upload ${{ steps.filenames.outputs.diktat-cli-zip }} | ||
if: ${{ github.ref_type == 'branch' }} | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ steps.filenames.outputs.diktat-cli-zip }} | ||
path: ${{ steps.filenames.outputs.diktat-cli-zip }} | ||
if-no-files-found: error | ||
retention-days: 1 | ||
|
||
- id: create_release | ||
if: ${{ github.ref_type == 'tag' }} | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: v${{ inputs.release-version }} | ||
draft: false | ||
prerelease: false | ||
|
||
- name: Upload release asset (${{ steps.filenames.outputs.diktat-cli-tgz }}) | ||
id: upload-release-asset-tgz | ||
if: ${{ github.ref_type == 'tag' }} | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ${{ steps.filenames.outputs.diktat-cli-tgz }} | ||
asset_name: ${{ steps.filenames.outputs.diktat-cli-tgz }} | ||
asset_content_type: application/gzip | ||
|
||
- name: Upload release asset (${{ steps.filenames.outputs.diktat-cli-zip }}) | ||
id: upload-release-asset-zip | ||
if: ${{ github.ref_type == 'tag' }} | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ${{ steps.filenames.outputs.diktat-cli-zip }} | ||
asset_name: ${{ steps.filenames.outputs.diktat-cli-zip }} | ||
asset_content_type: application/zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
name: Create a binary distribution (thin) | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
release-version: | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
dist: | ||
name: Binary distribution (thin) | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- id: filenames | ||
name: Archive names | ||
run: | | ||
echo "diktat-cli-tar=diktat-cli-${{ inputs.release-version }}.tar" >>"${GITHUB_OUTPUT}" | ||
echo "diktat-cli-tgz=diktat-cli-${{ inputs.release-version }}.tar.gz" >>"${GITHUB_OUTPUT}" | ||
echo "diktat-cli-zip=diktat-cli-${{ inputs.release-version }}.zip" >>"${GITHUB_OUTPUT}" | ||
shell: bash | ||
|
||
- name: Archive | ||
run: | | ||
tar cf '${{ steps.filenames.outputs.diktat-cli-tar }}' --exclude-backups --exclude-vcs --exclude-vcs-ignore --exclude='*.bat' --exclude='*.cmd' -C bin diktat | ||
gzip -9 '${{ steps.filenames.outputs.diktat-cli-tar }}' | ||
zip -jrX9 -Z bzip2 '${{ steps.filenames.outputs.diktat-cli-zip }}' bin | ||
shell: bash | ||
|
||
# Upload a .tar.gz artifact, except when this is a release. | ||
- name: Upload ${{ steps.filenames.outputs.diktat-cli-tgz }} | ||
if: ${{ github.ref_type == 'branch' }} | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ steps.filenames.outputs.diktat-cli-tgz }} | ||
path: ${{ steps.filenames.outputs.diktat-cli-tgz }} | ||
if-no-files-found: error | ||
retention-days: 1 | ||
|
||
# Upload a .zip artifact, except when this is a release. | ||
- name: Upload ${{ steps.filenames.outputs.diktat-cli-zip }} | ||
if: ${{ github.ref_type == 'branch' }} | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ steps.filenames.outputs.diktat-cli-zip }} | ||
path: ${{ steps.filenames.outputs.diktat-cli-zip }} | ||
if-no-files-found: error | ||
retention-days: 1 | ||
|
||
- id: create_release | ||
if: ${{ github.ref_type == 'tag' }} | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: v${{ inputs.release-version }} | ||
draft: false | ||
prerelease: false | ||
|
||
- name: Upload release asset (${{ steps.filenames.outputs.diktat-cli-tgz }}) | ||
id: upload-release-asset-tgz | ||
if: ${{ github.ref_type == 'tag' }} | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ${{ steps.filenames.outputs.diktat-cli-tgz }} | ||
asset_name: ${{ steps.filenames.outputs.diktat-cli-tgz }} | ||
asset_content_type: application/gzip | ||
|
||
- name: Upload release asset (${{ steps.filenames.outputs.diktat-cli-zip }}) | ||
id: upload-release-asset-zip | ||
if: ${{ github.ref_type == 'tag' }} | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ${{ steps.filenames.outputs.diktat-cli-zip }} | ||
asset_name: ${{ steps.filenames.outputs.diktat-cli-zip }} | ||
asset_content_type: application/zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: Move the Marketplace tag | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
release-version: | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
dist: | ||
name: Move the Marketplace tag | ||
# See https://docs.github.com/en/actions/learn-github-actions/contexts#github-context | ||
if: github.ref_type == 'tag' | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- id: tag | ||
name: Tag name | ||
run: | | ||
VERSION_MAJOR="$(echo '${{ inputs.release-version }}' | sed -nE '/^([0-9]+)\.[^\.]+.*$/s//\1/p')" | ||
echo "name=v${VERSION_MAJOR}" >>"${GITHUB_OUTPUT}" | ||
shell: bash | ||
|
||
# The tag may not exist yet, so continue on error. | ||
- name: Delete local tag | ||
run: | | ||
git tag -d '${{ steps.tag.outputs.name }}' | ||
continue-on-error: true | ||
shell: bash | ||
|
||
# The tag may not exist yet, so continue on error. | ||
- name: Delete remote tag | ||
run: | | ||
git push --delete origin '${{ steps.tag.outputs.name }}' | ||
continue-on-error: true | ||
shell: bash | ||
|
||
- name: Create local tag | ||
run: | | ||
git tag '${{ steps.tag.outputs.name }}' | ||
shell: bash | ||
|
||
- name: Push local tag | ||
run: | | ||
git push origin '${{ steps.tag.outputs.name }}' | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters