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

Begin testing automatic build & upload options for Go projects #45

Closed
atc0005 opened this issue Oct 12, 2022 · 3 comments
Closed

Begin testing automatic build & upload options for Go projects #45

atc0005 opened this issue Oct 12, 2022 · 3 comments
Assignees

Comments

@atc0005
Copy link
Owner

atc0005 commented Oct 12, 2022

This workflow looks promising:

https://github.com/sqlitebrowser/sqlitebrowser/blob/continuous/.github/workflows/cppcmake.yml

Current contents of workflow file:

name: CI

on:
  push:
    branches: ['*']
    tags:
    paths_ignore: ['docs/**']
  pull_request:
    branches: ['*']
  release:
    types: ['created']

defaults:
  run:
    shell: bash

jobs:
  build:
    name: ${{ matrix.os }} - SQLCipher ${{ matrix.sqlcipher }}
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: true
      matrix:
        os: [ubuntu-20.04]
        sqlcipher: ["0", "1"]
    steps:
    - name: Checkout
      uses: actions/checkout@v2
    - name: Install dependencies
      run: |
           sudo apt-get update
           sudo apt-get install qttools5-dev libqt5scintilla2-dev libqcustomplot-dev libsqlite3-dev libqt5svg5 libsqlcipher-dev
    - name: Configure CMake
      run: |
           cmake --version
           cmake -S . -B build -DCMAKE_BUILD_TYPE=Release \
                -DCMAKE_INSTALL_PREFIX=${PWD}/install \
                -DCPACK_PACKAGE_DIRECTORY=${PWD}/package \
                -DENABLE_TESTING=ON \
                -Dsqlcipher=${{ matrix.sqlcipher }}
    - name: Run make
      run: cmake --build build --config Release -j --target install
    - name: run tests
      run: ctest -V -C Release --test-dir build
    - name: Package
      run: |
           cmake --build build --config Release -j --target package
           cmake -E remove_directory package/_CPack_Packages
    - name: Upload package
      uses: actions/upload-artifact@master
      with:
        name: pkg-${{ matrix.os }}-sqlcipher${{ matrix.sqlcipher }}
        path: package
    - name: Upload to release page
      if: github.event_name == 'release'
      env:
        GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
        TAG: ${{ github.event.release.tag_name }}
        UPLOAD_URL: ${{ github.event.release.upload_url }}
      run: |
              # Do try this at home! The REST API is documented at
              # https://docs.github.com/en/free-pro-team@latest/rest and you can get a personal
              # access token at https://github.com/settings/tokens
              # (set GITHUB_TOKEN to "bearer abcdef1234")
              # you can get the UPLOAD_URL with a short bash snippet; make sure to set the env var TAG:
              # UPLOAD_URL=$(curl -H 'Accept: application/vnd.github.v3+json' $GITHUB_API_URL/repos/$GITHUB_REPOSITORY/releases/tags/$TAG | jq -r .upload_url)
              UPLOAD_URL=${UPLOAD_URL%\{*} # remove "{name,label}" suffix
              for pkg in package/*.*; do
                NAME=$(basename $pkg)
                MIME=$(file --mime-type $pkg|cut -d ' ' -f2)
                curl -X POST -H "Accept: application/vnd.github.v3+json" -H "Authorization: token $GITHUB_TOKEN" -H "Content-Type: $MIME" --data-binary @$pkg $UPLOAD_URL?name=$NAME
              done
@atc0005
Copy link
Owner Author

atc0005 commented Oct 12, 2022

This is also covered in the Go for DevOps book.

@atc0005
Copy link
Owner Author

atc0005 commented Oct 12, 2022

I've been giving some thought to the proposal mentioned here:

https://gist.github.com/steinwaywhw/a4cd19cda655b8249d908261a62687f8?permalink_comment_id=3936277#gistcomment-3936277

a note (for your repositories)

I advise using consistent file-names. I.E. don't include a versioning in the filename.
I know it sounds weird, but bear with me* for a second.

You know the .../releases/latest syntax right? did you know you can also use it to download files as well? (and not just to redirect to the latest release on Github?)

Here, try this URL for example: https://github.com/ytdl-org/youtube-dl/releases/latest/download/youtube-dl.exe.

this reduces the need to walk through Github-Releases API entirely! and simplify stuff for users and also web-services that crawls your repository (in-case you have a somewhat popular product :] ). You don't to maintain any kind of backend or domain at all and relink to to the latest binaries (for example: http://youtube-dl.org/downloads/latest/youtube-dl.exe). it is handled by github releases!

you can always include the version in a file named version.txt, or any meta-data, really. keep a consistent file-name here too.

got the idea from https://github.com/yt-dlp/yt-dlp#update

This would make it a lot easier for local deployment tooling to deploy updated assets directly from project repos using the /releases/latest URL pattern.

@atc0005 atc0005 pinned this issue Mar 23, 2023
atc0005 added a commit to atc0005/shared-project-resources that referenced this issue Jul 19, 2023
Untested workflow for conditionally generating a "stable"
release or a prerelease based on the tag associated with
the workflow execution.

If not explicitly opted-out by the calling workflow, release
assets are generated using the podman-release-build Makefile
recipe.

refs atc0005/todo#33
refs atc0005/todo#45
atc0005 added a commit to atc0005/shared-project-resources that referenced this issue Jul 19, 2023
Provide workflow for conditionally generating a "stable"
release or a prerelease based on the tag associated with
the workflow execution.

If not explicitly opted-out by the calling workflow, release
assets are generated using the podman-release-build Makefile
recipe.

refs atc0005/todo#33
refs atc0005/todo#45
@atc0005 atc0005 closed this as completed Jul 19, 2023
@atc0005 atc0005 unpinned this issue Jul 19, 2023
atc0005 added a commit to atc0005/bounce that referenced this issue Jul 20, 2023
Provide workflow used to automate the creation of GitHub releases upon
pushing a tag. The "upstream" workflow imported by this one applies
conditional logic (based on tag name) to determine whether a stable or
pre-release GitHub release is created.

By default, release assets are generated and provided by the release.
Library projects explicitly forgo the explicit generation of release
assets.

refs atc0005/todo#33
refs atc0005/todo#45
refs atc0005/todo#65
refs atc0005/shared-project-resources#141
atc0005 added a commit to atc0005/brick that referenced this issue Jul 20, 2023
Provide workflow used to automate the creation of GitHub releases upon
pushing a tag. The "upstream" workflow imported by this one applies
conditional logic (based on tag name) to determine whether a stable or
pre-release GitHub release is created.

By default, release assets are generated and provided by the release.
Library projects explicitly forgo the explicit generation of release
assets.

refs atc0005/todo#33
refs atc0005/todo#45
refs atc0005/todo#65
refs atc0005/shared-project-resources#141
atc0005 added a commit to atc0005/bridge that referenced this issue Jul 20, 2023
Provide workflow used to automate the creation of GitHub releases upon
pushing a tag. The "upstream" workflow imported by this one applies
conditional logic (based on tag name) to determine whether a stable or
pre-release GitHub release is created.

By default, release assets are generated and provided by the release.
Library projects explicitly forgo the explicit generation of release
assets.

refs atc0005/todo#33
refs atc0005/todo#45
refs atc0005/todo#65
refs atc0005/shared-project-resources#141
atc0005 added a commit to atc0005/check-cert that referenced this issue Jul 20, 2023
Provide workflow used to automate the creation of GitHub releases upon
pushing a tag. The "upstream" workflow imported by this one applies
conditional logic (based on tag name) to determine whether a stable or
pre-release GitHub release is created.

By default, release assets are generated and provided by the release.
Library projects explicitly forgo the explicit generation of release
assets.

refs atc0005/todo#33
refs atc0005/todo#45
refs atc0005/todo#65
refs atc0005/shared-project-resources#141
atc0005 added a commit to atc0005/check-illiad that referenced this issue Jul 20, 2023
Provide workflow used to automate the creation of GitHub releases upon
pushing a tag. The "upstream" workflow imported by this one applies
conditional logic (based on tag name) to determine whether a stable or
pre-release GitHub release is created.

By default, release assets are generated and provided by the release.
Library projects explicitly forgo the explicit generation of release
assets.

refs atc0005/todo#33
refs atc0005/todo#45
refs atc0005/todo#65
refs atc0005/shared-project-resources#141
atc0005 added a commit to atc0005/check-mail that referenced this issue Jul 20, 2023
Provide workflow used to automate the creation of GitHub releases upon
pushing a tag. The "upstream" workflow imported by this one applies
conditional logic (based on tag name) to determine whether a stable or
pre-release GitHub release is created.

By default, release assets are generated and provided by the release.
Library projects explicitly forgo the explicit generation of release
assets.

refs atc0005/todo#33
refs atc0005/todo#45
refs atc0005/todo#65
refs atc0005/shared-project-resources#141
atc0005 added a commit to atc0005/check-ntpt that referenced this issue Jul 20, 2023
Provide workflow used to automate the creation of GitHub releases upon
pushing a tag. The "upstream" workflow imported by this one applies
conditional logic (based on tag name) to determine whether a stable or
pre-release GitHub release is created.

By default, release assets are generated and provided by the release.
Library projects explicitly forgo the explicit generation of release
assets.

refs atc0005/todo#33
refs atc0005/todo#45
refs atc0005/todo#65
refs atc0005/shared-project-resources#141
atc0005 added a commit to atc0005/check-statuspage that referenced this issue Jul 20, 2023
Provide workflow used to automate the creation of GitHub releases upon
pushing a tag. The "upstream" workflow imported by this one applies
conditional logic (based on tag name) to determine whether a stable or
pre-release GitHub release is created.

By default, release assets are generated and provided by the release.
Library projects explicitly forgo the explicit generation of release
assets.

refs atc0005/todo#33
refs atc0005/todo#45
refs atc0005/todo#65
refs atc0005/shared-project-resources#141
atc0005 added a commit to atc0005/check-vmware that referenced this issue Jul 20, 2023
Provide workflow used to automate the creation of GitHub releases upon
pushing a tag. The "upstream" workflow imported by this one applies
conditional logic (based on tag name) to determine whether a stable or
pre-release GitHub release is created.

By default, release assets are generated and provided by the release.
Library projects explicitly forgo the explicit generation of release
assets.

refs atc0005/todo#33
refs atc0005/todo#45
refs atc0005/todo#65
refs atc0005/shared-project-resources#141
atc0005 added a commit to atc0005/check-whois that referenced this issue Jul 20, 2023
Provide workflow used to automate the creation of GitHub releases upon
pushing a tag. The "upstream" workflow imported by this one applies
conditional logic (based on tag name) to determine whether a stable or
pre-release GitHub release is created.

By default, release assets are generated and provided by the release.
Library projects explicitly forgo the explicit generation of release
assets.

refs atc0005/todo#33
refs atc0005/todo#45
refs atc0005/todo#65
refs atc0005/shared-project-resources#141
atc0005 added a commit to atc0005/dnsc that referenced this issue Jul 20, 2023
Provide workflow used to automate the creation of GitHub releases upon
pushing a tag. The "upstream" workflow imported by this one applies
conditional logic (based on tag name) to determine whether a stable or
pre-release GitHub release is created.

By default, release assets are generated and provided by the release.
Library projects explicitly forgo the explicit generation of release
assets.

refs atc0005/todo#33
refs atc0005/todo#45
refs atc0005/todo#65
refs atc0005/shared-project-resources#141
atc0005 added a commit to atc0005/elbow that referenced this issue Jul 20, 2023
Provide workflow used to automate the creation of GitHub releases upon
pushing a tag. The "upstream" workflow imported by this one applies
conditional logic (based on tag name) to determine whether a stable or
pre-release GitHub release is created.

By default, release assets are generated and provided by the release.
Library projects explicitly forgo the explicit generation of release
assets.

refs atc0005/todo#33
refs atc0005/todo#45
refs atc0005/todo#65
refs atc0005/shared-project-resources#141
atc0005 added a commit to atc0005/go-ezproxy that referenced this issue Jul 20, 2023
Provide workflow used to automate the creation of GitHub releases upon
pushing a tag. The "upstream" workflow imported by this one applies
conditional logic (based on tag name) to determine whether a stable or
pre-release GitHub release is created.

By default, release assets are generated and provided by the release.
Library projects explicitly forgo the explicit generation of release
assets.

refs atc0005/todo#33
refs atc0005/todo#45
refs atc0005/todo#65
refs atc0005/shared-project-resources#141
atc0005 added a commit to atc0005/go-lockss that referenced this issue Jul 20, 2023
Provide workflow used to automate the creation of GitHub releases upon
pushing a tag. The "upstream" workflow imported by this one applies
conditional logic (based on tag name) to determine whether a stable or
pre-release GitHub release is created.

By default, release assets are generated and provided by the release.
Library projects explicitly forgo the explicit generation of release
assets.

refs atc0005/todo#33
refs atc0005/todo#45
refs atc0005/todo#65
refs atc0005/shared-project-resources#141
atc0005 added a commit to atc0005/mysql2sqlite that referenced this issue Jul 20, 2023
Provide workflow used to automate the creation of GitHub releases upon
pushing a tag. The "upstream" workflow imported by this one applies
conditional logic (based on tag name) to determine whether a stable or
pre-release GitHub release is created.

By default, release assets are generated and provided by the release.
Library projects explicitly forgo the explicit generation of release
assets.

refs atc0005/todo#33
refs atc0005/todo#45
refs atc0005/todo#65
refs atc0005/shared-project-resources#141
atc0005 added a commit to atc0005/go-nagios that referenced this issue Jul 20, 2023
Provide workflow used to automate the creation of GitHub releases upon
pushing a tag. The "upstream" workflow imported by this one applies
conditional logic (based on tag name) to determine whether a stable or
pre-release GitHub release is created.

By default, release assets are generated and provided by the release.
Library projects explicitly forgo the explicit generation of release
assets.

refs atc0005/todo#33
refs atc0005/todo#45
refs atc0005/todo#65
refs atc0005/shared-project-resources#141
atc0005 added a commit to atc0005/go-teams-notify that referenced this issue Jul 20, 2023
Provide workflow used to automate the creation of GitHub releases upon
pushing a tag. The "upstream" workflow imported by this one applies
conditional logic (based on tag name) to determine whether a stable or
pre-release GitHub release is created.

By default, release assets are generated and provided by the release.
Library projects explicitly forgo the explicit generation of release
assets.

refs atc0005/todo#33
refs atc0005/todo#45
refs atc0005/todo#65
refs atc0005/shared-project-resources#141
atc0005 added a commit to atc0005/nagios-debug that referenced this issue Jul 20, 2023
Provide workflow used to automate the creation of GitHub releases upon
pushing a tag. The "upstream" workflow imported by this one applies
conditional logic (based on tag name) to determine whether a stable or
pre-release GitHub release is created.

By default, release assets are generated and provided by the release.
Library projects explicitly forgo the explicit generation of release
assets.

refs atc0005/todo#33
refs atc0005/todo#45
refs atc0005/todo#65
refs atc0005/shared-project-resources#141
atc0005 added a commit to atc0005/query-meta that referenced this issue Jul 20, 2023
Provide workflow used to automate the creation of GitHub releases upon
pushing a tag. The "upstream" workflow imported by this one applies
conditional logic (based on tag name) to determine whether a stable or
pre-release GitHub release is created.

By default, release assets are generated and provided by the release.
Library projects explicitly forgo the explicit generation of release
assets.

refs atc0005/todo#33
refs atc0005/todo#45
refs atc0005/todo#65
refs atc0005/shared-project-resources#141
atc0005 added a commit to atc0005/safelinks that referenced this issue Jul 20, 2023
Provide workflow used to automate the creation of GitHub releases upon
pushing a tag. The "upstream" workflow imported by this one applies
conditional logic (based on tag name) to determine whether a stable or
pre-release GitHub release is created.

By default, release assets are generated and provided by the release.
Library projects explicitly forgo the explicit generation of release
assets.

refs atc0005/todo#33
refs atc0005/todo#45
refs atc0005/todo#65
refs atc0005/shared-project-resources#141
atc0005 added a commit to atc0005/send2teams that referenced this issue Jul 20, 2023
Provide workflow used to automate the creation of GitHub releases upon
pushing a tag. The "upstream" workflow imported by this one applies
conditional logic (based on tag name) to determine whether a stable or
pre-release GitHub release is created.

By default, release assets are generated and provided by the release.
Library projects explicitly forgo the explicit generation of release
assets.

refs atc0005/todo#33
refs atc0005/todo#45
refs atc0005/todo#65
refs atc0005/shared-project-resources#141
atc0005 added a commit to atc0005/tsm-pass that referenced this issue Jul 20, 2023
Provide workflow used to automate the creation of GitHub releases upon
pushing a tag. The "upstream" workflow imported by this one applies
conditional logic (based on tag name) to determine whether a stable or
pre-release GitHub release is created.

By default, release assets are generated and provided by the release.
Library projects explicitly forgo the explicit generation of release
assets.

refs atc0005/todo#33
refs atc0005/todo#45
refs atc0005/todo#65
refs atc0005/shared-project-resources#141
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant