Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #19

Merged
merged 3 commits into from
Aug 7, 2021
Merged

Dev #19

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 0 additions & 44 deletions .github/workflows/build.yml

This file was deleted.

64 changes: 64 additions & 0 deletions .github/workflows/dev-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: "pre-release"

on:
workflow_dispatch:
push:
branches: [ main ]
tags-ignore:
- 'v*'
paths-ignore:
- .github/workflows/*
- README.md
- assets/*

jobs:
deps:
name: "Install Dependencies"
runs-on: windows-latest
steps:
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Python ${{ env.PYTHON_VER }}
uses: actions/setup-python@v2
with:
python-version: ${{ env.PYTHON_VER }}
- uses: actions/cache@v2
if: startsWith(runner.os, 'Windows')
with:
path: ~\AppData\Local\pip\Cache
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r ./requirements.txt -t ./lib
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: build-artifact
path: .
package:
name: Package Plugin
needs: deps
runs-on: "ubuntu-latest"
- name: Get release version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
- name: "Update plugin.json version to: ${{ env.VERSION }}"
uses: jossef/action-set-json-field@v1
with:
file: plugin.json
field: Version
value: "${{ env.VERSION }}-dev"
- name: Package files
run: |
zip -r "${{github.event.repository.name}}.zip" . -x '*.git*' -x 'demo.gif' -x 'README.md' -x 'assets/*'
- uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "dev"
prerelease: true
title: "Dev Build"
files: |
"${{github.event.repository.name}}.zip"
65 changes: 27 additions & 38 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,72 +1,61 @@
name: Release

on:
workflow_dispatch:
push:
branches: [ main ]
tags:
- 'v*'
paths-ignore:
- .github/workflows/*
- README.md
- assets/*

env:
PYTHON_VER: 3.6


jobs:
package:
release:
name: Package Release
needs: build
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO_SLUG: ${{ github.repository }}
BRANCH: "main"
WORKFLOW: "build.yml"
steps:
- id: curl
run: |
RUN_ID=$(curl -sLH 'Accept: application/vnd.github.v3+json' -H "Authorization: token $GITHUB_TOKEN" "api.github.com/repos/$REPO_SLUG/actions/workflows/$WORKFLOW/runs" | jq --arg branch "$BRANCH" -c '[.workflow_runs[] | select( .conclusion == "success" and .head_branch == $branch)][0] | .id')
echo "::set-output name=RUN_ID::$RUN_ID"
- name: Get release version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
- name: Download artifact
uses: dawidd6/action-download-artifact@v2
with:
github_token: ${{secrets.GITHUB_TOKEN}}
run_id: ${{ steps.curl.outputs.RUN_ID }}
name: build
workflow: ${{ env.WORKFLOW }}
path: .
- name: Checkout
uses: actions/checkout@v2
- name: "Update plugin.json version to: ${{ env.VERSION }}"
uses: jossef/action-set-json-field@v1
with:
file: plugin.json
field: Version
value: ${{ env.VERSION }}
- name: Get release version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
- name: Commit version change
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add ./plugin.json
git commit -m "bumping release ${{ env.VERSION }}"
git commit -m "bumping versioning ${{ env.VERSION }}"
- name: Push changes
uses: ad-m/github-push-action@v0.6.0
with:
github_token: ${{ github.token }}
- name: Move Flox to plugin root
- name: Download dev build
uses: dsaltares/fetch-gh-release-asset@master
with:
repo: ${{ github.repository }}
version: "tags/dev"
file: "${{github.event.repository.name}}.zip"
token: ${{ secrets.GITHUB_TOKEN }}
- name: Unzip prelease
run: |
mv ./lib/flox . && rm -r ./lib/Flox-*-info
- name: Package files
mkdir -p ./staging
unzip -d ./staging "${{github.event.repository.name}}.zip"
mv ./plugin.json ./staging
- name: Zip release
run: |
cd ./staging
zip -r "${{github.event.repository.name}}.zip" . -x '*.git*' -x 'demo.gif' -x 'README.md' -x 'assets/*'
- name: Publish
uses: "marvinpinto/action-automatic-releases@latest"
if: success()
uses: softprops/action-gh-release@v1
with:
files: "${{github.event.repository.name}}.zip"
tag_name: "v${{ env.VERSION }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "v${{ env.VERSION }}"
prerelease: false
title: "v${{ env.VERSION }}"
files: |
"${{github.event.repository.name}}.zip"

5 changes: 5 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
import sys
import os

plugindir = os.path.abspath(os.path.dirname(__file__))
sys.path.append(plugindir)
sys.path.append(os.path.join(plugindir, 'lib'))
sys.path.append(os.path.join(plugindir, 'plugin'))

from plugin.main import Commander

if __name__ == "__main__":
Expand Down