1
0

Use Jenkins!

This commit is contained in:
Noa Himesaka 2023-09-11 18:07:03 +09:00
parent 245282698f
commit e522f64d0d
2 changed files with 117 additions and 10 deletions

106
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,106 @@
pipeline {
agent none
stages {
stage('Docker') {
agent {
docker {
image 'docker:24-cli'
args '--privileged -v /var/run/docker.sock:/var/run/docker.sock'
}
}
when {
anyOf {
branch pattern: 'test-.*', comparator: "REGEXP";
branch 'main';
buildingTag();
}
}
environment {
DOCKER_REGISTRY = 'ghcr.io'
GITHUB_ORG = 'funamitech'
DOCKER_IMAGE = "${env.DOCKER_REGISTRY}/${env.GITHUB_ORG}/mastodon"
GHCR_TOKEN = credentials('siliconforest-jenkins-github-pat-package-rw')
}
stages {
stage('Prepare') {
steps {
script {
if (env.BRANCH_NAME.startsWith('test-')) {
env.DOCKER_TAG = 'testing'
env.DOCKER_LATEST = 'false'
} else {
env.DOCKER_TAG = env.TAG_NAME.replaceAll('\\+', '-')
env.DOCKER_LATEST = 'true'
}
env.GITHUB_REPOSITORY = "${params.URL}"
env.SOURCE_BASE_URL = "https://github.com/funamitech/mastodon" // I'm lazy. Will fix it later
env.SOURCE_TAG = "${env.BRANCH_NAME}"
}
}
}
stage('Docker login') {
steps {
sh 'echo $GHCR_TOKEN_PSW | docker login ghcr.io -u $GHCR_TOKEN_USR --password-stdin'
}
}
stage('Build') {
matrix {
axes {
axis {
name 'TARGET'
values 'amd64'
}
}
stages {
stage('Build platform specific image') {
steps {
sh "docker build -t $DOCKER_IMAGE:$DOCKER_TAG-${TARGET} --platform linux/${TARGET} --build-arg \"GITHUB_REPOSITORY=${GITHUB_REPOSITORY}\" --build-arg \"SOURCE_BASE_URL=${SOURCE_BASE_URL}\" --build-arg \"SOURCE_TAG=${SOURCE_TAG}\" ."
script {
if (env.DOCKER_LATEST == 'true') {
sh "docker tag $DOCKER_IMAGE:$DOCKER_TAG-${TARGET} $DOCKER_IMAGE:latest-${TARGET}"
}
}
}
}
stage('Push platform specific image') {
steps {
sh "docker push $DOCKER_IMAGE:$DOCKER_TAG-${TARGET}"
script {
if (env.DOCKER_LATEST == 'true') {
sh "docker push $DOCKER_IMAGE:latest-${TARGET}"
}
}
}
}
}
}
}
stage('Docker manifest') {
steps {
sh "docker manifest create $DOCKER_IMAGE:$DOCKER_TAG --amend $DOCKER_IMAGE:$DOCKER_TAG-amd64"
script {
if (env.DOCKER_LATEST == 'true') {
sh "docker manifest create $DOCKER_IMAGE:latest --amend $DOCKER_IMAGE:latest-amd64"
}
}
}
}
stage('Docker push') {
steps {
sh "docker manifest push $DOCKER_IMAGE:$DOCKER_TAG"
script {
if (env.DOCKER_LATEST == 'true') {
sh "docker manifest push $DOCKER_IMAGE:latest"
}
}
}
}
}
post {
always {
sh 'docker logout "$DOCKER_REGISTRY"'
}
}
}
}
}

View File

@ -1,14 +1,15 @@
# Mastodon Glitch Edition
# Mastodon YRYR-Glitch
> Now with automated deploys!
> Now with 100% more Yui Funami!
[![Build Status](https://img.shields.io/circleci/project/github/funamitech/mastodon.svg)][circleci]
[![Code Climate](https://img.shields.io/codeclimate/maintainability/funamitech/mastodon.svg)][code_climate]
So here's the deal: assets are customized, you are on your own replacing our assets with yours (or vanilla ones)
[circleci]: https://circleci.com/gh/funamitech/mastodon
[code_climate]: https://codeclimate.com/github/funamitech/mastodon
Added features over glitch-soc:
- Nori tokenizer for better Korean search (You **MUST** use {Elastic,Open}Search with necessary plugins installed, otherwise search feature won't work *at all*)
- YuruVerse assets (logos, etc)
- Birdsite theme adapted to glitch-soc based forks
- Pretendard font for better Korean glyphs
- Emoji reactions! (compatible with Misskey of course)
- And more things...?
So here's the deal: we all work on this code, and anyone who uses that does so absolutely at their own risk. can you dig it?
- You can view documentation for this project at [glitch-soc.github.io/docs/](https://glitch-soc.github.io/docs/).
- And contributing guidelines are available [here](CONTRIBUTING.md) and [here](https://glitch-soc.github.io/docs/contributing/).
We also recommend applying wide custom emoji CSS for better experience.