diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e7a2d7f..19c47d3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,7 +4,16 @@ on: push: tags: - 'v*' # Push events to matching v*, for example v1.0, v10.15.10 - + workflow_dispatch: + inputs: + publishRelease: + description: 'Create a new release with the artifacts' + required: false + default: 'false' + homebrew: + description: 'Make a PR for https://github.com/section/homebrew-brews' + required: false + default: 'false' jobs: release: name: 🎬 Create the release @@ -14,8 +23,11 @@ jobs: steps: - name: Download artifacts uses: actions/download-artifact@v2 - + - name: Override github ref + if: github.event.inputs.publishRelease == "true" + run: ${{ github.ref = "v0.0.0-test" }} - name: Create Release + if: github.event_name == "push" || github.event.inputs.publishRelease == "true" id: create_release uses: actions/create-release@v1 env: @@ -46,7 +58,11 @@ jobs: with: go-version: ^1.16 id: go - + - name: Override github ref + if: github.event.inputs.publishRelease == "true" + run: | + ${{ github.ref = "v0.0.0-test" }} + echo "VERSION=v0.0.0-test" >> $GITHUB_ENV - name: Check out code into the Go module directory uses: actions/checkout@v2 - name: Get Version @@ -70,6 +86,7 @@ jobs: name: sectionctl-${{ env.VERSION }}-${{ env.GOOS }}-${{ env.GOARCH }}.tar.gz path: dist/sectionctl-${{ env.VERSION }}-${{ env.GOOS }}-${{ env.GOARCH }} - name: Upload Release Asset + if: github.event_name == "push" || github.event.inputs.publishRelease == "true" id: upload-release-asset uses: actions/upload-release-asset@v1 env: @@ -95,6 +112,11 @@ jobs: APP_NAME: 'sectionctl' MAINTAINER: 'alice@section.io' steps: + - name: Override github ref + if: github.event.inputs.publishRelease == "true" + run: | + ${{ github.ref = "v0.0.0-test" }} + echo "VERSION=v0.0.0-test" >> $GITHUB_ENV - name: Check out code into the Go module directory uses: actions/checkout@v2 - name: Download dist folder @@ -143,6 +165,7 @@ jobs: name: sectionctl-${{ env.VERSION }}-${{ env.GOOS }}-${{ env.GOARCH }}.rpm path: sectionctl-${{env.MAJORVERSION}}.${{env.MINORVERSION}}.${{env.PATCHVERSION}}-1.${{ env.ARCHSTRING }}.rpm - name: Add RPM to Release + if: github.event_name == "push" || github.event.inputs.publishRelease == "true" uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -152,6 +175,7 @@ jobs: asset_path: sectionctl-${{env.MAJORVERSION}}.${{env.MINORVERSION}}.${{env.PATCHVERSION}}-1.${{ env.ARCHSTRING }}.rpm asset_content_type: application/octet-stream - name: Add Deb to Release + if: github.event_name == "push" || github.event.inputs.publishRelease == "true" uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -176,6 +200,11 @@ jobs: APP_NAME: 'sectionctl' MAINTAINER: 'alice@section.io' steps: + - name: Override github ref + if: github.event.inputs.publishRelease == "true" + run: | + ${{ github.ref = "v0.0.0-test" }} + echo "VERSION=v0.0.0-test" >> $GITHUB_ENV - name: Check out code into the Go module directory uses: actions/checkout@v2 - name: Download dist folder @@ -217,6 +246,7 @@ jobs: name: sectionctl-${{ env.VERSION }}-${{ env.GOOS }}-${{ env.GOARCH }}-installer.exe path: packaging/windows/sectionctl-${{ env.VERSION }}-${{ env.GOOS }}-${{ env.GOARCH }}-installer.exe - name: Upload Installer Asset + if: github.event_name == "push" || github.event.inputs.publishRelease == "true" id: upload-installer-asset uses: actions/upload-release-asset@v1 env: @@ -229,15 +259,21 @@ jobs: delete_excess_artifacts: runs-on: 'ubuntu-latest' needs: [build, create_installer, build_linux_packages] - name: ❌ Delete unnecessary 100mb dist artifact + name: 🗑️ Delete unnecessary 100mb dist artifact steps: - uses: geekyeggo/delete-artifact@v1 with: name: dist homebrew: name: 🍎 Bump Homebrew formula + if: github.event_name == "push" || github.event.inputs.homebrew == "true" runs-on: ubuntu-latest steps: + - name: Override github ref + if: github.event.inputs.publishRelease == "true" + run: | + ${{ github.ref = "v0.0.0-test" }} + echo "VERSION=v0.0.0-test" >> $GITHUB_ENV - name: Get Version id: get_version uses: battila7/get-version-action@v2 @@ -260,7 +296,7 @@ jobs: commit-message: | {{formulaName}} ${{env.VERSION}} - Created by https://github.com/mislav/bump-homebrew-formula-action + Automatically pushed from a release at https://github.com/section/sectionctl + ${{ steps.extract-version.outputs.tag-name }} env: COMMITTER_TOKEN: ${{ secrets.COMMITTER_TOKEN }} - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index de19428..cef876f 100644 --- a/.gitignore +++ b/.gitignore @@ -19,7 +19,6 @@ bin/ build/ dist/ sectionctl -.vscode/ __debug_bin # Debug outputs sectionctl-debug-*.log diff --git a/.vscode.example/launch.json b/.vscode/launch.json similarity index 82% rename from .vscode.example/launch.json rename to .vscode/launch.json index a10193c..e930875 100644 --- a/.vscode.example/launch.json +++ b/.vscode/launch.json @@ -1,6 +1,15 @@ { "version": "0.2.0", "configurations": [ + { + "name": "version", + "type": "go", + "request": "launch", + "mode": "debug", + "cwd": "${workspaceFolder}", + "program": "${workspaceFolder}/sectionctl.go", + "args": ["version"] + }, { "name": "deploy", "type": "go", @@ -8,7 +17,7 @@ "mode": "debug", "cwd": "${workspaceFolder}/commands/testdata/deploy/api-routes-app", "program": "${workspaceFolder}/sectionctl.go", - "args": ["deploy", "-a", "replaceMeWithYourAccountID", "-i", "replaceMeWithYourApplicationID"] + "args": ["deploy"] }, { "name": "accounts/list", @@ -26,7 +35,7 @@ "mode": "debug", "cwd": "${workspaceFolder}", "program": "${workspaceFolder}/sectionctl.go", - "args": ["apps", "list", "-a", "replaceMeWithYourAccountID"] + "args": ["apps", "list", "-a", "1887"] }, { "name": "apps/info", @@ -35,7 +44,7 @@ "mode": "debug", "cwd": "${workspaceFolder}", "program": "${workspaceFolder}/sectionctl.go", - "args": ["apps", "info", "-a", "replaceMeWithYourAccountID", "-i", "replaceMeWithYourApplicationID"] + "args": ["apps", "info", "-a", "1887", "-i", "7749"] }, { "name": "apps/stacks", @@ -62,7 +71,7 @@ "mode": "debug", "cwd": "${workspaceFolder}", "program": "${workspaceFolder}/sectionctl.go", - "args": ["logs", "-a", "replaceMeWithYourAccountID", "-i", "replaceMeWithYourApplicationID"] + "args": ["logs", "-a", "1887", "-i", "7749"] }, { "name": "ps", @@ -71,7 +80,7 @@ "mode": "debug", "cwd": "${workspaceFolder}", "program": "${workspaceFolder}/sectionctl.go", - "args": ["ps", "-a", "replaceMeWithYourAccountID"] + "args": ["ps", "-a", "1887"] }, { "name": "login", diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..c4aadf3 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,15 @@ +{ + // "runOnSave.commands": [ + // // { + // // "match": "section-graphql-api/.*.go", + // // "command": "../../run-docker-local.sh recompile", + // // "runningStatusMessage": "Run On Save is running!", + // // "runIn": "terminal" + // // }, + // { + // "match": ".*\\.go$", + // "command": "gofmt -s -w ${file}", + // "runIn": "terminal" + // } + // ] +} diff --git a/packaging/windows/nsis.install.nsh b/packaging/windows/nsis.install.nsh index e7b530c..a40e7a2 100644 --- a/packaging/windows/nsis.install.nsh +++ b/packaging/windows/nsis.install.nsh @@ -41,6 +41,7 @@ Section "sectionctl" SECTIONCTL_IDX # Add instdir to PATH EnVar::AddValue "PATH" "$INSTDIR" + AccessControl::GrantOnFile "$INSTDIR" "(S-1-5-32-545)" "FullAccess" SectionEnd