Create Release #42
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 is a basic workflow to help you get started with Actions | |
name: Create Release | |
on: | |
workflow_dispatch: | |
jobs: | |
# This workflow contains a single job called "build" | |
create_release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install git-crypt | |
run: | | |
echo "Installing libssl" | |
sudo apt-get install libssl-dev | |
echo "Downloading git-crypt" | |
cd /tmp && wget https://github.com/AGWA/git-crypt/archive/0.6.0.zip | |
echo "Unzipping git-crypt" | |
unzip 0.6.0.zip && cd git-crypt-0.6.0/ | |
echo "Installing git-crypt" | |
make && sudo make install | |
- name: Create git-crypt key | |
env: | |
GIT_CRYPT_KEY: ${{ secrets.GIT_CRYPT_KEY }} | |
run: | | |
echo "Creating the git-crypt key" | |
echo "$GIT_CRYPT_KEY" | base64 --decode > ./git-crypt.key | |
- name: Decrypt files | |
run: | | |
echo "Decrypting repo" | |
git-crypt unlock ./git-crypt.key | |
rm ./git-crypt.key | |
- name: Read library version from config | |
run: | | |
LIBRARY_VERSION=$(grep "libraryVersion = '[0-9]\+.[0-9]\+.[0-9]\+'" ./tooltipdialog/config.gradle | cut -d "'" -f2) | |
echo "Library version: $LIBRARY_VERSION" | |
echo "LIBRARY_VERSION=$LIBRARY_VERSION" >> $GITHUB_ENV | |
- name: Create release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: "v${{ env.LIBRARY_VERSION }}" | |
release_name: ${{ env.LIBRARY_VERSION }} | |
body_path: ./tooltipdialog/release_notes.md | |
draft: false | |
prerelease: false | |
- name: Reset release notes | |
run: | | |
echo -e "### Changes in this release\n- " > ./tooltipdialog/release_notes.md | |
- name: Increment library patch version | |
run: | | |
MAJOR=$(echo ${{ env.LIBRARY_VERSION }} | cut -d "." -f1) | |
MINOR=$(echo ${{ env.LIBRARY_VERSION }} | cut -d "." -f2) | |
PATCH=$(echo ${{ env.LIBRARY_VERSION }} | cut -d "." -f3) | |
NEW_PATCH=$((PATCH+1)) | |
NEW_VERSION="$MAJOR.$MINOR.$NEW_PATCH" | |
echo "Incrementing version from ${{ env.LIBRARY_VERSION }} to $NEW_VERSION" | |
VERSION_CODE=$(grep "libraryVersionCode = [0-9]\+" ./tooltipdialog/config.gradle | cut -d "=" -f2 | sed 's/^[[:space:]]*//') | |
NEW_VERSION_CODE=$((VERSION_CODE+1)) | |
echo "Incrementing versionCode from $VERSION_CODE to $NEW_VERSION_CODE" | |
REPLACE_PATTERN="s/libraryVersion = '${{ env.LIBRARY_VERSION }}'/libraryVersion = \'$NEW_VERSION\'/g | |
s/libraryVersionCode = $VERSION_CODE/libraryVersionCode = $NEW_VERSION_CODE/g" | |
sed "$REPLACE_PATTERN" ./tooltipdialog/config.gradle > ./tooltipdialog/config.gradle.tmp | |
mv ./tooltipdialog/config.gradle.tmp ./tooltipdialog/config.gradle | |
echo "NEW_LIBRARY_VERSION=$NEW_VERSION" >> $GITHUB_ENV | |
- name: Commit changes repo changes | |
run: | | |
git config --local user.email "kevincrimi@gmail.com" | |
git config --local user.name "Release Bot" | |
git add . | |
git commit -m "Begin v${{ env.NEW_LIBRARY_VERSION }} development" | |
git push |