Added secrets #75
Workflow file for this run
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
name: Release BeSman | |
on: | |
push: | |
# Sequence of patterns matched against refs/tags | |
tags: | |
- '*.*.*' | |
env: | |
BES_ARCHIVE_DOWNLOAD_REPO: ${{ secrets.BES_ARCHIVE_DOWNLOAD_REPO }} | |
BESMAN_NAMESPACE: ${{ secrets.BESMAN_NAMESPACE }} | |
jobs: | |
publish_artifacts: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set env for version | |
run: echo "BESMAN_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_RELEASE_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-$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 $BESMAN_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: Switch 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 dist -- | |
- 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 |