Skip to content

Updated

Updated #66

Workflow file for this run

name: Release BeSman
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- '*.*.*'
env:
BES_ARCHIVE_DOWNLOAD_REPO: "BeSman"
BESMAN_NAMESPACE: "asa1997"
BESMAN_VERSION: ${{ github.ref }}
jobs:
publish_artifacts:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set env for version
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: list
run: ls
- name: Copy and replace template files
run: |
cp scripts/tmpl/*.tmpl scripts/
file=scripts/get.besman.io.tmpl
sed -i "s/@BES_VERSION@/$BESMAN_VERSION/g" $file
sed -i "s/@BES_ARCHIVE_DOWNLOAD_REPO@/$BES_ARCHIVE_DOWNLOAD_REPO/g" $file
sed -i "s/@BES_NAMESPACE@/$BESMAN_NAMESPACE/g" $file
mv "$file" "${file//.tmpl/}"
- name: Setting up dir
run: mkdir -p build/tmp
- name: Generate artifacts
run: |
zip -rj ./build/tmp/besman-latest.zip ./dist/list.txt ./src/main/bash/besman-* ./src/main/bash/scripts/besman-* ./src/main/bash/commands/besman-*
cp ./build/tmp/besman-latest.zip ./build/tmp/besman-$RELEASE_VERSION.zip
mv ./scripts/get.besman.io ./build/tmp/
ls ./build/tmp/
- name: Commit artifacts to dist branch
run: |
git config --global user.name 'GitHub Action'
git config --global user.email 'action@github.com'
git fetch origin dist
git checkout -b dist origin/dist
mkdir -p dist
cp -r ./build/tmp/* ./dist/
git add ./dist/*
git commit -m "Release version $RELEASE_VERSION"
git push origin HEAD:dist
create_release:
needs: publish_artifacts
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/besman-latest.zip
asset_name: besman-latest.zip
asset_content_type: application/zip