Skip to content

Push Build

Push Build #12

Workflow file for this run

name: Push Build
# For releases
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Get Version
id: get_version
run: |
echo ::set-output name=VERSION::${GITHUB_REF#refs/*/}
echo ::set-output name=VERSION2::${GITHUB_REF#refs/*/v}
shell: bash
- name: Version
run: |
echo Version: $VERSION
echo Version2: $VERSION2
- name: Checkout
uses: actions/checkout@v2
- name: Update module.json
run: |
echo Version: ${{ steps.get_version.outputs.VERSION }}
echo Version2: ${{ steps.get_version.outputs.VERSION2 }}
echo Download url: ${{ steps.upload-release-asset.browser_download_url }}
sed -i '/"version":/c\ "version": "${{ steps.get_version.outputs.VERSION2 }}",' module.json
sed -i '/"download":/c\ "download": "https://github.com/datdamnzotz/FoundryVTT-DnD-Audio-Bundle-Hammer-Home/releases/download/${{ steps.get_version.outputs.VERSION }}/${{ steps.get_version.outputs.VERSION }}.zip"' module.json
cat module.json
- name: Zip project # This would actually build your project, using zip for an example artifact
run: 7z a -tzip ${{ steps.get_version.outputs.VERSION }}.zip . -mx0 -xr!.git -xr!.github
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload Release Assets
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 }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./${{ steps.get_version.outputs.VERSION }}.zip
asset_name: ${{ steps.get_version.outputs.VERSION }}.zip
asset_content_type: application/zip
- name: Commit changes
uses: EndBug/add-and-commit@v4
with:
author_name: Github Workflow
message: "Github Workflow"
ref: 'master'
add: module.json
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}