|
| 1 | +# This is a basic workflow to help you get started with Actions |
| 2 | + |
| 3 | +name: CI |
| 4 | + |
| 5 | +# Controls when the workflow will run |
| 6 | +on: |
| 7 | + # Triggers the workflow on push or pull request events but only for the "main" branch |
| 8 | + release: |
| 9 | + types: ["published"] |
| 10 | + |
| 11 | + # Allows you to run this workflow manually from the Actions tab |
| 12 | + workflow_dispatch: |
| 13 | + |
| 14 | +# A workflow run is made up of one or more jobs that can run sequentially or in parallel |
| 15 | +jobs: |
| 16 | + # This workflow contains a single job called "build" |
| 17 | + build: |
| 18 | + # The type of runner that the job will run on |
| 19 | + runs-on: ubuntu-latest |
| 20 | + permissions: write-all |
| 21 | + |
| 22 | + # Steps represent a sequence of tasks that will be executed as part of the job |
| 23 | + steps: |
| 24 | + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
| 25 | + - uses: actions/checkout@v3 |
| 26 | + |
| 27 | + # Runs a single command using the runners shell |
| 28 | + - name: Remove .git |
| 29 | + run: rm -rf .git |
| 30 | + |
| 31 | + - name: Remove .github |
| 32 | + run: rm -rf .github |
| 33 | + |
| 34 | + - name: Remove README.md |
| 35 | + run: rm -rf README.md |
| 36 | + |
| 37 | + - name: Remove notes.txt |
| 38 | + run: rm -rf notes.txt |
| 39 | + |
| 40 | + - name: Extract current version |
| 41 | + id: get-version |
| 42 | + run: | |
| 43 | + version=$(jq -r '.version' swinfo.json) |
| 44 | + echo "Version is $version" |
| 45 | + echo "version=$version" >> $GITHUB_ENV |
| 46 | + echo "artifact_name=WheresMyCrewCapsule-$version.zip" >> $GITHUB_ENV |
| 47 | + echo "upload_url=$(wget -qO- https://api.github.com/repos/$GITHUB_REPOSITORY/releases | jq '.[0].upload_url' | tr -d \")" >> $GITHUB_ENV |
| 48 | +
|
| 49 | + - name: Build release zip |
| 50 | + - uses: montudor/action-zip@v1 |
| 51 | + with: |
| 52 | + args: zip -qq -r release.zip . |
| 53 | + |
| 54 | + - name: Publish release |
| 55 | + uses: shogo82148/actions-upload-release-asset@v1.7.2 |
| 56 | + env: |
| 57 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 58 | + with: |
| 59 | + upload_url: ${{ env.upload_url }} |
| 60 | + asset_path: release.zip |
| 61 | + asset_name: ${{ env.artifact_name }} |
| 62 | + asset_content_type: application/zip |
| 63 | + |
| 64 | + |
0 commit comments