Skip to content
This repository has been archived by the owner on Apr 1, 2022. It is now read-only.

Commit

Permalink
(#123) v0.4.0:
Browse files Browse the repository at this point in the history
* (#112) Add Git aliases, switch from Travis to GitHub Actions;
* (#113) Fix the Publish Docker workflow;
* (#114) Upgrade to `Ubuntu 20.10`, remove redundant parts;
* (#117) Switch to Podman for building OCI compliant containers;
* (#120) Rewrite the workflow scripts;
* (#121) Update the contents;
* (#122) Hide the output when installing Rust.
  • Loading branch information
Pavel Sobolev authored Feb 2, 2021
2 parents 256aa20 + c8832fb commit b0a10b7
Show file tree
Hide file tree
Showing 32 changed files with 283 additions and 327 deletions.
28 changes: 0 additions & 28 deletions .github/scripts/build.bash

This file was deleted.

51 changes: 0 additions & 51 deletions .github/scripts/publish-docker.bash

This file was deleted.

17 changes: 17 additions & 0 deletions .github/scripts/publish.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

# A script to build and push the image

# Build the image
podman build --squash-all -t $IMAGENAME .

# Login to the GHCR
echo $GHCR_PAT | podman login ghcr.io -u $USERNAME --password-stdin

# Push the latest version
podman push $IMAGENAME ghcr.io/$OWNER/$IMAGENAME:latest

# Push the release version
if [ "$PUBLISH_RELEASE_VERSION" = true ]; then
podman push dev ghcr.io/$OWNER/$IMAGENAME:$RELEASE_VERSION
fi
49 changes: 49 additions & 0 deletions .github/scripts/version.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/bash

# A script to determine whether a
# release version should be pushed

# Get last published version
LAST_VERSION=$(curl --silent "https://api.github.com/repos/$REPOSITORY/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')

# Check if there is some tag
if [ ! -z "$LAST_VERSION" ]; then

# Get current tag
CURRENT_TAG=$(echo ${GITHUB_REF#refs/*/})

# Print info
echo -e "\n\e[1;36mLast version: $LAST_VERSION\e[0m"
echo -e "\e[1;36mCurrent tag: $CURRENT_TAG\e[0m\n"

# Check if the tag is a semantic version
if echo "$CURRENT_TAG" | grep -E "^v[0-9]+\.[0-9]+\.[0-9]+$"; then

# Print information
echo -e "\e[1;36mCurrent tag is a semantic version. Tagged image will be published.\e[0m\n"

# Set environment variable
echo "RELEASE_VERSION=$(echo $CURRENT_TAG | sed 's/v//')" >> $GITHUB_ENV

# Publish tagged image
echo "PUBLISH_RELEASE_VERSION=true" >> $GITHUB_ENV

else

# Print information
echo -e "\e[1;36mCurrent tag is not a semantic version. Tagged image will not be published.\e[0m\n"

# Don't publish tagged image
echo "PUBLISH_RELEASE_VERSION=false" >> $GITHUB_ENV

fi

else

# Print information
echo -e "\n\e[1;36mNo release has been found, tagged version will not be published.\e[0m\n"

# Don't publish tagged image
echo "PUBLISH_RELEASE_VERSION=false" >> $GITHUB_ENV

fi
15 changes: 15 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Build

on:
pull_request:
branches:
- develop

jobs:
Build:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@master
- name: Build the image
run: podman build --squash-all -t dev .
36 changes: 0 additions & 36 deletions .github/workflows/publish-docker.yml

This file was deleted.

26 changes: 26 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Publish

on:
release:
types: [published]
push:
branches:
- develop

env:
GHCR_PAT: ${{ secrets.GHCR_PAT }}
IMAGENAME: ${{ github.event.repository.name }}
OWNER: ${{ github.repository_owner }}
REPOSITORY: ${{ github.repository }}
USERNAME: ${{ github.actor }}

jobs:
Publish:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@master
- name: Determine whether to upload a release version
run: bash .github/scripts/version.bash
- name: Publish to GHCR
run: bash .github/scripts/publish.bash
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: Release Drafter
name: Release

on:
push:
branches:
- develop

jobs:
update:
Release:
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v5
with:
config-name: config/release-drafter.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22 changes: 0 additions & 22 deletions .travis.yml

This file was deleted.

Loading

0 comments on commit b0a10b7

Please sign in to comment.