Skip to content

Commit

Permalink
Merge pull request #16 from warpdl/dev
Browse files Browse the repository at this point in the history
WarpDL v1.0.0
  • Loading branch information
celestix authored Feb 13, 2024
2 parents 3686ebb + 4b95a1b commit 20a8a47
Show file tree
Hide file tree
Showing 59 changed files with 5,367 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
42 changes: 42 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: CI

on:
push:
branches:
- main
- dev
tags-ignore:
- "**"
pull_request:
workflow_dispatch:

jobs:
ci:
name: Goreleaser CI
runs-on: ubuntu-20.04
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
permissions:
contents: write
steps:
- name: Configure git
run: git config --global url."https://celestix:${{ secrets.GH_PAT }}@github.com".insteadOf "https://github.com"
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "stable"
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
version: latest
args: release --snapshot --skip-publish --clean
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
226 changes: 226 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,226 @@
name: Release

on:
push:
tags:
- "*"
workflow_dispatch:
inputs:
tag:
description: "Tag to release"
required: true
snap_channel:
description: "Snap release channel"
required: false
type: choice
default: 'edge'
options:
- stable
- candidate
- beta
- edge

jobs:
ci:
name: Goreleaser CI
runs-on: ubuntu-20.04
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
permissions:
contents: write
steps:
- name: Configure git
run: git config --global url."https://celestix:${GITHUB_TOKEN}@github.com".insteadOf "https://github.com"
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "stable"
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
version: latest
args: release --snapshot --skip=publish --clean
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

update-install-script:
name: Update scripts/install.sh in warp-releases
runs-on: ubuntu-latest
needs: ci
env:
CLI_REPO: warpdl/warpdl
RELEASES_REPO: warpdl/warp-releases
steps:
- name: Get latest tag
run: |-
tag=${{ github.event.inputs.tag }} # if triggered by workflow_dispatch
if [ -z "$tag" ]; then
tag=${GITHUB_REF#refs/tags/}
fi
echo "RELEASE_VERSION=$tag" >> $GITHUB_ENV
- name: Checkout warp
uses: actions/checkout@v4
with:
path: ./warpdl
- name: Checkout warp-releases
uses: actions/checkout@v4
with:
repository: ${{ env.RELEASES_REPO }}
persist-credentials: false
fetch-depth: 0
path: ./warp-releases
- name: Copy existing files from warpdl to releases repo
run: |-
sed -i "s/LATEST_RELEASE=.*/LATEST_RELEASE=\"${{ env.RELEASE_VERSION }}\"/g" ./warpdl/scripts/install.sh
cp ./warpdl/scripts/install.sh ./warp-releases/scripts/install.sh
sed -i "s/version:.*/version: '${{ env.RELEASE_VERSION }}'/g" ./warpdl/snap/snapcraft.yaml
cp ./warpdl/snap/snapcraft.yaml ./warp-releases/snap/snapcraft.yaml
mkdir -p ./warp-releases/configs/rpm/ && cp ./warpdl/configs/rpm/config.rpm.txt ./warp-releases/configs/rpm/config.rpm.txt
mkdir -p ./warp-releases/keys/ && cp ./warpdl/keys/key.gpg ./warp-releases/keys/key.gpg
- name: Commit changes
run: |-
git config --global user.email "[email protected]"
git config --global user.name "celestix"
cd warp-releases && git add . && git commit -m "bump to ${{ env.RELEASE_VERSION }}"
cd ..
cd warpdl && git add . && git commit -m "bump to ${{ env.RELEASE_VERSION }}"
- name: Push warp-releases changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GH_PAT }}
repository: ${{ env.RELEASES_REPO }}
directory: ./warp-releases
- name: Push warp cli changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GH_PAT }}
repository: ${{ env.CLI_REPO }}
directory: ./warpdl

goreleaser:
name: Run GoReleaser
needs: update-install-script
runs-on: ubuntu-20.04
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
steps:
- name: Set up git
run: git config --global url."https://celestix:${GITHUB_TOKEN}@github.com".insteadOf "https://github.com"
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "stable"
- name: Install UPX
uses: crazy-max/ghaction-upx@v3
with:
install-only: true
# only run this step when the tag is not already created
- if: startsWith(github.ref, 'refs/tags/') != 'true' && github.event.inputs.tag != ''
name: Create and Push Tag
run: |-
git config --global user.email "[email protected]"
git config --global user.name "celestix"
tag=${{ github.event.inputs.tag }} # if triggered by workflow_dispatch
if [ -z "$tag" ]; then
tag=${GITHUB_REF#refs/tags/}
fi
git tag -f -a -m "$tag" "$tag"
git push -f origin "$tag"
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
- name: Push to fury
run: |-
./scripts/gemfury/push.sh
env:
GEMFURY_PUSH_KEY: ${{ secrets.GEMFURY_PUSH_KEY }}

snapcraft:
name: Publish snaps
runs-on: ubuntu-20.04
needs: goreleaser
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
strategy:
matrix:
platform:
- i386
- amd64
- arm64
steps:
- uses: docker/setup-qemu-action@v2
- name: Set up git
run: git config --global url."https://celestix:${GITHUB_TOKEN}@github.com".insteadOf "https://github.com"
- name: Checkout
uses: actions/checkout@v4
- name: Pull changes
run: git pull origin dev
- name: Build snaps
uses: diddlesnaps/snapcraft-multiarch-action@v1
id: build
with:
architecture: ${{ matrix.platform }}
- name: Publish snaps
uses: snapcore/action-publish@v1
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }}
with:
snap: ${{ steps.build.outputs.snap }}
release: ${{ github.event.inputs.snap_channel }}

# run-tests:
# name: Run test scripts
# runs-on: ubuntu-latest
# needs: snapcraft
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# - name: Test ubuntu docker
# run: |-
# echo "Testing ubuntu"
# time docker run --rm -v "$(pwd)/tests/":/app:ro ubuntu /app/distros/ubuntu-debian.sh
# - name: Test debian docker
# run: |-
# echo "Testing debian"
# time docker run --rm -v "$(pwd)/tests/":/app:ro debian /app/distros/ubuntu-debian.sh
# - name: Test fedora docker
# run: |-
# echo "Testing fedora"
# time docker run --rm -v "$(pwd)/tests/":/app:ro fedora /app/distros/fedora-centos.sh
# - name: Test centos docker
# run: |-
# echo "Testing centos"
# time docker run --rm -v "$(pwd)/tests/":/app:ro centos /app/distros/fedora-centos.sh
# - name: Test alpine docker
# run: |-
# echo "Testing alpine"
# time docker run --rm -v "$(pwd)/tests/":/app:ro alpine /app/distros/alpine.sh
# - name: Test docker image
# run: |-
# ./tests/test-docker-image.sh
114 changes: 114 additions & 0 deletions .github/workflows/rt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
name: RTEST

on:
# push:
# tags:
# - "*"
workflow_dispatch:
inputs:
tag:
description: "Tag to release"
required: true

jobs:
test-tg-message:
name: "Test Sending TG Message"
runs-on: ubuntu-20.04
steps:
- uses: appleboy/telegram-action@master
with:
to: ${{ vars.TELEGRAM_RELEASE_CHAT_ID }}
token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
format: "markdown"
message: |
Test Message
Please ignore!

# update-install-script:
# name: Update scripts/install.sh in warp-releases
# runs-on: ubuntu-latest
# env:
# CLI_REPO: warpdl/warp
# steps:
# - name: Get latest tag
# run: |-
# tag=${{ github.event.inputs.tag }} # if triggered by workflow_dispatch
# if [ -z "$tag" ]; then
# tag=${GITHUB_REF#refs/tags/}
# fi
# echo "RELEASE_VERSION=$tag" >> $GITHUB_ENV
# - name: Checkout warp
# uses: actions/checkout@v3
# with:
# path: ./warp
# - name: Copy existing files from warp to warpdl
# run: |-
# sed -i "s/version:.*/version: '${{ env.RELEASE_VERSION }}'/g" ./warp/snap/snapcraft.yaml
# - name: Commit changes
# run: |-
# git config --global user.email "[email protected]"
# git config --global user.name "Divkix"
# cd warp && git add . && git commit -m "bump to ${{ env.RELEASE_VERSION }}"
# - name: Push warp cli changes
# uses: ad-m/github-push-action@master
# with:
# github_token: ${{ secrets.GH_PAT }}
# repository: ${{ env.CLI_REPO }}
# directory: ./warp

# goreleaser:
# name: Run test
# needs: update-install-script
# runs-on: ubuntu-latest
# env:
# GITHUB_TOKEN: ${{ secrets.GH_PAT }}
# strategy:
# matrix:
# platform:
# - i386
# - amd64
# - arm64
# steps:
# - name: Set up git
# run: git config --global url."https://divkix:${GITHUB_TOKEN}@github.com".insteadOf "https://github.com"
# - name: Checkout
# uses: actions/checkout@v3
# - name: test
# run: |-
# git pull
# - name: Build snaps
# uses: snapcore/action-build@v1
# - run: ls

# goreleaser:
# name: Run test
# needs: update-install-script
# runs-on: ubuntu-latest
# env:
# GITHUB_TOKEN: ${{ secrets.GH_PAT }}
# strategy:
# matrix:
# platform:
# - i386
# - amd64
# - arm64
# steps:
# - uses: docker/setup-qemu-action@v2
# - name: Set up git
# run: git config --global url."https://divkix:${GITHUB_TOKEN}@github.com".insteadOf "https://github.com"
# - name: Checkout
# uses: actions/checkout@v3
# - name: test
# run: |-
# git pull
# - name: Build snaps
# uses: diddlesnaps/snapcraft-multiarch-action@v1
# id: build
# with:
# architecture: ${{ matrix.platform }}
# - run: |
# ls
# echo Built: ${{ steps.build.outputs.snap }}
Loading

0 comments on commit 20a8a47

Please sign in to comment.